Virtual prediction buffer for intra block copy in video coding

ABSTRACT

A method of visual media processing method includes performing a conversion between a current video block of a current picture of a visual media data and a bitstream representation of the visual media data. The conversion is based on a reference region from the current picture comprising reference samples used for deriving a prediction block of the current video block. A virtual buffer of a defined size is used for tracking availability of the reference samples for deriving the prediction block.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2020/099702, filed on Jul. 1, 2020, which claims the priority toand benefits of International Patent Application No. PCT/CN2019/094957,filed on Jul. 6, 2019 and International Patent Application No.PCT/CN2019/095297, filed on Jul. 9, 2019. All the aforementionedapplications are incorporated by reference as part of the disclosure ofthis application.

TECHNICAL FIELD

This patent document relates to video coding and decoding techniques,devices and systems.

BACKGROUND

In spite of the advances in video compression, digital video stillaccounts for the largest bandwidth use on the internet and other digitalcommunication networks. As the number of connected user devices capableof receiving and displaying vi

deo increases, it is expected that the bandwidth demand for digitalvideo usage will continue to grow.

SUMMARY

The present document describes various embodiments and techniques forbuffer management and block vector coding for intra block copy mode fordecoding or encoding video or images.

In one example aspect, a method of visual media processing is disclosed.The method includes determining, for a conversion between a currentvideo block of a current picture of a visual media data and a bitstreamrepresentation of the current video block, a block vector (BVx,BVy),wherein validity of the block vector (BVx, BVy) is independent of (1) alocation (P, Q) of a sample block and/or (2) whether a sample at thelocation (P,Q) is reconstructed, and/or (3) a location of the currentvideo block, wherein, the block vector (BVx, BVy) represents a pixeldisplacement between the current video block and the sample block; andperforming, using the block vector, the conversion in an intra blockcopy mode which is based on a reconstructed block located in same videoregion with the current video block comprising reference samples usedfor deriving a prediction block of the current video block, wherein,during the conversion, a prediction sample with a location (A, B) fromreference samples in a buffer is determined at least according to a sizeof the buffer and/or the block vector (BVx, BVy).

In another example aspect, another method of visual media processing isdisclosed. The method includes determining, for a conversion between acurrent video block of a current picture of a visual media data and abitstream representation of the visual media data, whether a blockvector (BVx, BVy) corresponding to the current video block is validaccording to a rule, wherein the block vector (BVx, BVy) represents apixel displacement between the current video block and a sample block;and performing, using the block vector, the conversion based on areference region from the current picture comprising reference samplesused for deriving a prediction block of the current video block, whereinthe rule specifies that the block vector (BVx, BVy) is valid in casethat (1) one or more samples from the sample block are outside thecurrent picture and/or (2) one or more samples from the sample block areoutside at least one coding tree unit (CTU) associated with the currentvideo block, and/or (3) one or more samples from the sample block failto be reconstructed.

In yet another example aspect, another method of visual media processingis disclosed. The method includes performing a conversion between acurrent video block of a current picture of a visual media data and abitstream representation of the visual media data, wherein, theconversion is based on a reference region from the current picturecomprising reference samples used for deriving a prediction block of thecurrent video block, and wherein a virtual buffer of a defined size isused for tracking availability of the reference samples for deriving theprediction block.

In yet another example aspect, another method of visual media processingis disclosed. The method includes maintaining, for a conversion betweena current video block of a current picture of a visual media data and abitstream representation of the visual media data, a buffer comprisingreference samples from the current picture for a derivation of aprediction block of the current video block, wherein one or morereference samples in the buffer that are marked unavailable for thederivation have values outside of a pixel value range.

In another example aspect, another method of video processing isdisclosed. The method includes performing a conversion between a currentvideo block of a current picture of a visual media data and a bitstreamrepresentation of the visual media data using a buffer comprisingreference samples from the current picture for derivation of aprediction block of the current video block, wherein the conversion isbased according to rule which specifies that, for the bitstreamrepresentation to conform the rule, a reference sample in the buffer isto satisfy a bitstream conformance constraint.

In yet another example aspect, a video encoder or decoder apparatuscomprising a processor configured to implement an above described methodis disclosed.

In another example aspect, a computer readable program medium isdisclosed. The medium stores code that embodies processor executableinstructions for implementing one of the disclosed methods.

These, and other, aspects are described in greater details in thepresent document.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 shows an example of current picture referencing or intra blockcopy video or image coding technique.

FIG. 2 shows an example of dynamic reference area.

FIG. 3 shows an example of coding of a block starting from (x,y).

FIG. 4 shows examples of possible alternative way to choose the previouscoded 64×64 blocks.

FIG. 5 shows an example of a possible alternative way to change thecoding/decoding order of 64×64 blocks.

FIG. 6 is a flowchart of an example method of video or image processing.

FIG. 7 is a block diagram of a hardware platform for video or imagecoding or decoding.

FIG. 8 shows another possible alternative way to choose the previouscoded 64×64 blocks, when the decoding order for 64×64 blocks is from topto bottom, left to right.

FIG. 9 shows another possible alternative way to choose the previouscoded 64×64 blocks.

FIG. 10 shows an example flowchart for a decoding process withreshaping.

FIG. 11 shows another possible alternative way to choose the previouscoded 64×64 blocks, when the decoding order for 64×64 blocks is fromleft to right, top to bottom.

FIG. 12 is an illustration of IBC reference buffer status, where a blockdenotes a 64×64 CTU.

FIG. 13 shows one arrangement of reference area for IBC.

FIG. 14 shows another arrangement of reference area for IBC.

FIG. 15 shows another arrangement of reference area for IBC when thecurrent virtual pipeline data unit (VPDU) is to the right side of thepicture boundary.

FIG. 16 shows an example of the status of virtual buffer when VPDUs in aCTU row are decoded sequentially.

FIG. 17 is a block diagram of an example video processing system inwhich disclosed techniques may be implemented.

FIG. 18 is a flowchart of an example method of visual media processing.

FIG. 19 is a flowchart of an example method of visual media processing.

FIG. 20 is a flowchart of an example method of visual media processing.

FIG. 21 is a flowchart of an example method of visual media processing.

FIG. 22 is a flowchart of an example method of visual media processing.

DETAILED DESCRIPTION

Section headings are used in the present document for ease ofunderstanding and do not limit scope of the disclosed embodiments ineach section only to that section. The present document describesvarious embodiments and techniques for buffer management and blockvector coding for intra block copy mode for decoding or encoding videoor images.

1. Summary

This patent document is related to video coding technologies.Specifically, it is related to intra block copy in video coding. It maybe applied to the standard under development, e.g. Versatile VideoCoding. It may be also applicable to future video coding standards orvideo codec.

2. Brief Discussion

Video coding standards have evolved primarily through the development ofthe well-known ITU-T and ISO/IEC standards. The ITU-T produced H.261 andH.263, ISO/IEC produced MPEG-1 and MPEG-4 Visual, and the twoorganizations jointly produced the H.262/MPEG-2 Video and H.264/MPEG-4Advanced Video Coding (AVC) and H.265/HEVC standards. Since H.262, thevideo coding standards are based on the hybrid video coding structurewherein temporal prediction plus transform coding are utilized. Toexplore the future video coding technologies beyond HEVC, Joint VideoExploration Team (JVET) was founded by VCEG and MPEG jointly in 2015.Since then, many new methods have been adopted by JVET and put into thereference software named Joint Exploration Model (JEM). In April 2018,the Joint Video Expert Team (JVET) between VCEG (Q 6/16) and ISO/IECJTC1 SC29/WG11 (MPEG) was created to work on the VVC standard targetingat 50% bitrate reduction compared to HEVC.

2.1 Inter Prediction in HEVC/H.265

Each inter-predicted PU has motion parameters for one or two referencepicture lists. Motion parameters include a motion vector and a referencepicture index. Usage of one of the two reference picture lists may alsobe signalled using inter_pred_idc. Motion vectors may be explicitlycoded as deltas relative to predictors.

When a CU is coded with skip mode, one PU is associated with the CU, andthere are no significant residual coefficients, no coded motion vectordelta or reference picture index. A merge mode is specified whereby themotion parameters for the current PU are obtained from neighbouring PUs,including spatial and temporal candidates. The merge mode can be appliedto any inter-predicted PU, not only for skip mode. The alternative tomerge mode is the explicit transmission of motion parameters, wheremotion vector (to be more precise, motion vector differences (MVD)compared to a motion vector predictor), corresponding reference pictureindex for each reference picture list and reference picture list usageare signalled explicitly per each PU. Such a mode is named Advancedmotion vector prediction (AMVP) in this disclosure.

When signalling indicates that one of the two reference picture lists isto be used, the PU is produced from one block of samples. This isreferred to as ‘uni-prediction’. Uni-prediction is available both forP-slices and B-slices.

When signalling indicates that both of the reference picture lists areto be used, the PU is produced from two blocks of samples. This isreferred to as ‘bi-prediction’. Bi-prediction is available for B-slicesonly.

The following text provides the details on the inter prediction modesspecified in HEVC. The description will start with the merge mode.

2.2 Current Picture Referencing

Current Picture Referencing (CPR), or once named as Intra Block Copy(IBC) has been adopted in HEVC Screen Content Coding extensions(HEVC-SCC) and the current VVC test model. IBC extends the concept ofmotion compensation from inter-frame coding to intra-frame coding. Asdemonstrated in FIG. 1 , the current block is predicted by a referenceblock in the same picture when CPR is applied. The samples in thereference block must have been already reconstructed before the currentblock is coded or decoded. Although CPR is not so efficient for mostcamera-captured sequences, it shows significant coding gains for screencontent. The reason is that there are lots of repeating patterns, suchas icons and text characters in a screen content picture. CPR can removethe redundancy between these repeating patterns effectively. InHEVC-SCC, an inter-coded coding unit (CU) can apply CPR if it choosesthe current picture as its reference picture. The MV is renamed as blockvector (BV) in this case, and a BV always has an integer-pixelprecision. To be compatible with main profile HEVC, the current pictureis marked as a “long-term” reference picture in the Decoded PictureBuffer (DPB). It should be noted that similarly, in multiple view/3Dvideo coding standards, the inter-view reference picture is also markedas a “long-term” reference picture.

Following a BV to find its reference block, the prediction can begenerated by copying the reference block. The residual can be got bysubtracting the reference pixels from the original signals. Thentransform and quantization can be applied as in other coding modes.

FIG. 1 is an example illustration of Current Picture Referencing.

However, when a reference block is outside of the picture, or overlapswith the current block, or outside of the reconstructed area, or outsideof the valid area restricted by some constraints, part or all pixelvalues are not defined. Basically, there are two solutions to handlesuch a problem. One is to disallow such a situation, e.g. in bitstreamconformance. The other is to apply padding for those undefined pixelvalues. The following sub-sessions describe the solutions in detail.

2.3 CPR in HEVC Screen Content Coding Extensions

In the screen content coding extensions of HEVC, when a block usescurrent picture as reference, it should guarantee that the wholereference block is within the available reconstructed area, as indicatedin the following spec text:

-   The variables offsetX and offsetY are derived as follows:    offsetX=(ChromaArrayType==0)?0:(mvCLX[0]& 0x?2:0)  (8-104)    offsetY=(ChromaArrayType==0)?0:(mvCLX[1]& 0x?2:0)  (8-105)-   It is a requirement of bitstream conformance that when the reference    picture is the current picture, the luma motion vector mvLX shall    obey the following constraints:    -   When the derivation process for z-scan order block availability        as specified in clause 6.4.1 is invoked with (xCurr, yCurr) set        equal to (xCb, yCb) and the neighbouring luma locatiors (xNbY,        yNbY) set equal to (xPb+(MvLX[0]>>2)− offsetX, yPb=(mvLx[1]>>2)−        offsetY) as inputs, the output shall be equal to TRUE.    -   When the derivation process for z-scan order block availability        as specified in clause 6.4.1 is invoked with (xCurr, yCurr) set        equal to (xCb, yCb) and the neighbouring luma location (xNbY,        yNbY) set equal to (xPb+(mvLX[0]>>2)+ nPbW−1+ offsetX,        yPb+(mvLX[1]>>2)+ nPbH−1+ offsetY) as inputs, the output shall        be equal to TRUE.    -   One or both of the following conditions shall be true:        -   The value of (mvLX[0]>>2)+ nPbW+nB1+ offsetX is less than or            equal to 0.        -   The value of (mvLX[1]>>2)+ nPbH+yB1+ offsetY is less than or            equal to 0.    -   The following condition shall be true:        (xPb+(mvLX[0]>>2)+nPbSw−1+offsetX)/CtbSizeY−xCb/CtbSizeY⇐yCb/CtbSizeY−(yPb+(+LX[1]>>2)+nPbSh−1+offsetY)/CtbSizeY  (8-106)

Thus, the case that the reference block overlaps with the current blockor the reference block is outside of the picture will not happen. Thereis no need to pad the reference or prediction block.

2.4 Examples of CPR/IBC

In a VVC test model, the whole reference block should be with thecurrent coding tree unit (CTU) and does not overlap with the currentblock. Thus, there is no need to pad the reference or prediction block.

When dual tree is enabled, the partition structure may be different fromluma to chroma CTUs. Therefore, for the 4:2:0 colour format, one chromablock (e.g., CU) may correspond to one collocated luma region which havebeen split to multiple luma CUs.

The chroma block could only be coded with the CPR mode when thefollowing conditions shall be true:

-   -   1) each of the luma CU within the collocated luma block shall be        coded with CPR mode    -   2) each of the luma 4×4 block' BV is firstly converted to a        chroma block's BV and the chroma block's BV is a valid BV.

If any of the two condition is false, the chroma block shall not becoded with CPR mode.

It is noted that the definition of ‘valid BV’ has the followingconstraints:

-   -   1) all samples within the reference block identified by a BV        shall be within the restricted search range (e.g., shall be        within the same CTU in current VVC design).    -   2) all samples within the reference block identified by a BV        have been reconstructed.

2.5 Examples of CPR/IBC

In some examples, the reference area for CPR/IBC is restricted to thecurrent CTU, which is up to 128×128. The reference area is dynamicallychanged to reuse memory to store reference samples for CPR/IBC so that aCPR/IBC block can have more reference candidate while the referencebuffer for CPR/IBC can be kept or reduced from one CTU.

FIG. 2 shows a method, where a block is of 64×64 and a CTU contains 464×64 blocks. When coding a 64×64 block, the previous 3 64×64 blocks canbe used as reference. By doing so, a decoder just needs to store 4 64×64blocks to support CPR/IBC.

Suppose that the current luma CU's position relative to the upper-leftcorner of the picture is (x, y) and block vector is (BVx, BVy). In thecurrent design, if the BV is valid can be told by that the luma position((x+ BVx)>>6<<6+(1<<7), (y+ BVy)××6<<6) has not been reconstructed and((x+ BVx)>>6<<6+(1<<7), (y+ BVy)>>6<<6) is not equal to (x>>6<<6,y>>6<<6).

2.6 In-Loop Reshaping (ILR)

The basic idea of in-loop reshaping (ILR) is to convert the original (inthe first domain) signal (prediction/reconstruction signal) to a seconddomain (reshaped domain).

The in-loop luma reshaper is implemented as a pair of look-up tables(LUTs), but only one of the two LUTs need to be signaled as the otherone can be computed from the signaled LUT. Each LUT is aone-dimensional, 10-bit, 1024-entry mapping table (1D-LUT). One LUT is aforward LUT, FwdLUT, that maps input luma code values Y_(i) to alteredvalues Y_(r):Y_(r)=FwdLUT[Y_(i)]. The other LUT is an inverse LUT,InvLUT, that maps altered code values Y_(r) toŶ_(i):Ŷ_(i)=InvLUT[Y_(r)]. (Ŷ_(i) represents the reconstruction valuesof Y_(i).).

2.6.1 PWL Model

Conceptually, piece-wise linear (PWL) is implemented in the followingway:

Let x1, x2 be two input pivot points, and y1, y2 be their correspondingoutput pivot points for one piece. The output value y for any inputvalue x between x1 and x2 can be interpolated by the following equation:y=((y2−y1)/(x2−x1))*(x−x1)+y1

In fixed point implementation, the equation can be rewritten as:y=((m*x+2^(FP_PREC−1))>>FP_PREC)+c

where m is scalar, c is an offset, and FP_PREC is a constant value tospecify the precision.

In some examples, the PWL model is used to precompute the 1024-entryFwdLUT and InvLUT mapping tables; but the PWL model also allowsimplementations to calculate identical mapping values on-the-fly withoutpre-computing the LUTs.

2.6.2.1 Luma Reshaping

A method of the in-loop luma reshaping provides a lower complexitypipeline that also eliminates decoding latency for block-wise intraprediction in inter slice reconstruction. Intra prediction is performedin reshaped domain for both inter and intra slices.

Intra prediction is always performed in reshaped domain regardless ofslice type. With such arrangement, intra prediction can startimmediately after previous TU reconstruction is done. Such arrangementcan also provide a unified process for intra mode instead of being slicedependent. FIG. 10 shows the block diagram of the CE12-2 decodingprocess based on mode.

16-piece piece-wise linear (PWL) models are tested for luma and chromaresidue scaling instead of the 32-piece PWL models.

Inter slice reconstruction with in-loop luma reshaper (light-greenshaded blocks indicate signal in reshaped domain: luma residue; intraluma predicted; and intra luma reconstructed).

2.6.2.2 Luma-Dependent Chroma Residue Scaling

Luma-dependent chroma residue scaling is a multiplicative processimplemented with fixed-point integer operation. Chroma residue scalingcompensates for luma signal interaction with the chroma signal. Chromaresidue scaling is applied at the TU level. More specifically, thefollowing applies:

-   -   For intra, the reconstructed luma is averaged.    -   For inter, the prediction luma is averaged.

The average is used to identify an index in a PWL model. The indexidentifies a scaling factor cScaleInv. The chroma residual is multipliedby that number.

It is noted that the chroma scaling factor is calculated fromforward-mapped predicted luma values rather than reconstructed lumavalues.

2.6.2.3 Signalling of ILR Side Information

The parameters are (currently) sent in the tile group header (similar toALF). These reportedly take 40-100 bits.

In some examples, the added syntax is highlighted in italics.

In 7.3.2.1 Sequence parameter set RBSP syntax

seq_parameter_set_rbsp( ) { Descriptor  sps_seq_parameter_set_id ue(v)...  sps_triangle_enabled_flag u(1)  sps_ladf_enabled_flag u(1)  if (sps_ladf_enabled_flag ) {   sps_num_ladf_intervals_minus2 u(2)  sps_ladf_lowest_interval_qp_offset se(v)   for( i = 0; i<sps_num_ladf_intervals_minus2 + 1; i++ ) {    sps_ladf_qp_offset[ i ]se(v)    sps_ladf_delta_threshold_minus1[ i ] ue(v)   }  }  

 rbsp_trailing_bits( ) }In 7.3.3.1 General tile group header syntax

tile_group_header( ) { Descriptor ...  if(num_tiles_in_tile_group_minus1 > 0) {   offset_len_minus1 ue(v)   for( i= 0; i < num_tiles_in_tile_group minus1; i++ )   entry_point_offset_minus1[ i ] u(v)  }  if (sps_reshaper_enabled_flag ) {   

u(1)   if( tile_group_reshaper_model_present_flag )   tile_group_reshaper_model ( )   

u(1)   if( tile_group_reshaper_enable_flag && (!(qtbtt-dual_tree_intra_flag && tile_group_type == I ) ) )    

u(1)  }  byte_alignment( ) }Add a new syntax table tile group reshaper model:

tile_group_reshaper_model ( ) {

 

ue(v)  

ue(v)  

ue(v)  for (i = reshaper_model_min_bin_idx; i <=reshaper_model_max_bin_idx; i++ ) {   

 [ i ] u(v)   if ( reshaper_model bin_delta_abs_CW[ i ] ) >0 )    

u(1)  } }In General sequence parameter set RBSP semantics, add the followingsemantics:

-   sps_reshaper_enabled_flag equal to 1 specifies that reshaper is used    in the coded video sequence (CVS), sps_reshaper_enabled_flag equal    to 0 specifies that reshaper is not used in the CVS.    In tile group header syntax, add the following semantics-   tile_group_reshaper_model_present_flag equal to 1 specifies    tile_group_reshaper_model( ) is present in tile group header.    tile_group_reshaper_model_present_flag equal to 0 specifies    tile_group_reshaper_model( ) is not present in tile group header.    When tile_group_reshaper_model_present_flag is not present, it is    inferred to be equal to 0.-   tile_group_reshaper_enabled_flag equal to 1 specifies that reshaper    is enabled for the current tile group.    tile_group_reshaper_enabled_flag equal to 0 specifies that reshaper    is not enabled for the current tile group. When    tile_group_reshaper_enable_flag is not present, it is inferred to be    equal to 0.-   tile_group_reshaper_chroma_residual_scale_flag equal to 1 specifies    that chroma residual scaling is enabled for the current tile group.    tile_group_reshaper_chroma_residual_scale_flag equal to 0 specifies    that chroma residual scaling is not enabled for the current tile    group. When tile_group_reshaper_chroma_residual_scale_flag is not    present, it is inferred to be equal to 0.    Add tile_group_reshaper_model( ) syntax-   reshape_model_min_bin_idx specifies the minimum bin (or piece) index    to be used in the reshaper construction process. The value of    reshape_model_min_bin_idx shall be in the range of 0 to MaxBinIdx,    inclusive. The value of MaxBinIdx shall be equal to 15.-   reshape_model_delta_max_bin_idx specifies the maximum allowed bin    (or piece) index MaxBinIdx minus the maximum bin index to be used in    the reshaper construction process. The value of    reshape_model_max_bin_idx is set equal to    MaxBinIdx—reshape_model_delta_max_bin_idx.-   reshaper_model_bin_delta_abs_cw_prec_minus1 plus 1 specifies the    number of bits used for the representation of the syntax    reshape_model_bin_delta_abs_CW[i].-   reshape_model_bin_delta_abs_CW[i]specifies the absolute delta    codeword value for the ith bin.-   reshaper_model_bin_delta_sign_CW_flag[i]specifies the sign of    reshape_model_bin_delta_abs_CW[i] as follows:    -   If reshape_model_bin_delta_sign_CW_flag[i] is equal to 0, the        corresponding variable RspDeltaCW[i] is a positive value.    -   Otherwise (reshape_model_bin_delta_sign_CW_flag[i] is not equal        to 0), the corresponding variable RspDeltaCW[i] is a negative        value.

When reshape_model_bin_delta_sign_CW_flag[i] is not present, it isinferred to be equal to 0.

The variable RspDeltaCW[i]=(1 2*reshape_model_bin_delta_sign_CW[i])*reshape model bin delta abs CW [ i];

The variable RspCW[i] is derived as following steps:

The variable OrgCW is set equal to (1<<BitDepth_(Y))/(MaxBinId_(X)+1).

-   If reshaper_model_min_bin_idx<=i<=reshaper_model_max_bin_idx    RspCW[i]=OrgCW+ RspDeltaCW[i].-   Otherwise, RspCW[i]=0.

The value of RspCW[i]shall be in the range of 32 to 2*OrgCW−1 if thevalue of BitDepth_(Y) is equal to 10.

The variables InputPivot[i] with i in the range of 0 to MaxBinIdx+1,inclusive are derived as followsInputPivot[i]=i*OrgCW

The variable ReshapePivot[i] with i in the range of 0 to MaxBinIdx+1,inclusive, the variable ScaleCoef[i] and InvScaleCoeff[i] with i in therange of 0 to MaxBinIdx, inclusive, are derived as follows:

shiftY = 14 ReshapePivot[ 0 ] = 0; for( i = 0; i <= MaxBinIdx ; i++) {ReshapePivot[ i + 1 ] = ReshapePivot[ i ] + RspCW[ i ]  ScaleCoef[ i ] =( RspCW[ i ] * (1 << shiftY) + (1 << (Log2(OrgCW) − 1))) >>(Log2(OrgCW))  if ( RspCW[ i ] == 0 )   InvScaleCoeff[ i ] = 0  else  InvScaleCoeff[ i ] = OrgCW * (1 << shiftY) / RspCW[ i ] }

The variable ChromaScaleCoef[i] with i in the range of 0 to MaxBinIdx,inclusive, are derived as follows:

-   -   ChromaResidualScaleLut[64]={16384, 16384, 16384, 16384, 16384,        16384, 16384, 8192, 8192, 8192, 8192, 5461, 5461, 5461, 5461,        4096, 4096, 4096, 4096, 3277, 3277, 3277, 3277, 2731, 2731,        2731, 2731, 2341, 2341, 2341, 2048, 2048, 2048, 1820, 1820,        1820, 1638, 1638, 1638, 1638, 1489, 1489, 1489, 1489, 1365,        1365, 1365, 1365, 1260, 1260, 1260, 1260, 1170, 1170, 1170,        1170, 1092, 1092, 1092, 1092, 1024, 1024, 1024, 1024};    -   shiftC=11    -   if (RspCW[i]==0)        -   ChromaScaleCoef[i]=(1<<shiftC)    -   Otherwise (RspCW[i]l=0),        ChromaScaleCoef[i]=ChromaResidualScaleLut[RspCW[i]>>1]        2.6.2.4 Usage of ILR

At the encoder side, each picture (or tile group) is firstly convertedto the reshaped domain. And all the coding process is performed in thereshaped domain. For intra prediction, the neighboring block is in thereshaped domain; for inter prediction, the reference blocks (generatedfrom the original domain from decoded picture buffer) are firstlyconverted to the reshaped domain. Then the residual are generated andcoded to the bitstream.

After the whole picture (or tile group) finishes encoding/decoding,samples in the reshaped domain are converted to the original domain,then deblocking filter and other filters are applied.

Forward reshaping to the prediction signal is disabled for the followingcases:

Current block is intra-coded

Current block is coded as CPR (current picture referencing, aka intrablock copy, IBC)

Current block is coded as combined inter-intra mode (CIIP) and theforward reshaping is disabled for the intra prediction block

3. Examples of Problems Solved by Various Embodiments

In the current design of CPR/IBC, some problems exist.

-   -   1) The reference area changes dynamically, which makes        encoder/decoder processing complicated.    -   2) Invalid block vectors are easily generated and difficult to        check, which complicates both encoder and decoder.    -   3) Irregular reference area leads to inefficient coding of block        vector.    -   4) How to handle CTU size smaller than 128×128 is not clear.    -   5) In the determination process of whether a BV is valid or        invalid, for chroma blocks, the decision is based on the luma        sample's availability which may result in wrong decisions due to        the dual tree partition structure.

4. Example Embodiments

In some embodiments, a regular buffer can be used for CPR/IBC block toget reference.

A function isRec (x,y) is defined to indicate if pixel (x,y) has beenreconstructed and be referenced by IBC mode. When (x,y) is out ofpicture, of different slice/tile/brick, isRec (x,y) return false; when(x,y) has not been reconstructed, isRec (x,y) returns false. In anotherexample, when sample (x,y) has been reconstructed but some otherconditions are satisfied, it may also be marked as unavailable, such asout of the reference area/in a different VPDU, and isRec (x,y) returnsfalse.

A function isRec (c,x,y) is defined to indicate if sample (x,y) forcomponent c is available. For example, if the sample (x, y) hasn't beenreconstructed yet, it is marked as unavailable. In another example, whensample (x,y) has been reconstructed but some other conditions aresatisfied, it may also be marked as unavailable, such as it is out ofpicture/in a different slice/tile/brick/in a different VPDU, out ofallowed reference area. isRec (c,x,y) returns false when sample (x, y)is unavailable, otherwise, it returns true.

In the following discussion, the reference samples can be reconstructedsamples. It is noted that ‘pixel buffer’ may response to ‘buffer of onecolor component’ or ‘buffer of multiple color components’.

Reference Buffer for CPR/IBC

-   -   1. It is proposed to use a M×N pixel buffer to store the luma        reference samples for CPR/IBC.        -   a. In one example, the buffer size is 64×64.        -   b. In one example, the buffer size is 128×128.        -   c. In one example, the buffer size is 64×128.        -   d. In one example, the buffer size is 128×64.        -   e. In one example, N equals to the height of a CTU.        -   f. In one example, N=nH, where H is the height of a CTU, n            is a positive integer.        -   g. In one example, M equals to the width of a CTU.        -   h. In one example, M=mW, where W is the width of a CTU, m is            a positive integer.        -   i. In one example, the buffer size is unequal to the CTU            size, such as 96×128 or 128×96.        -   j. In one example, the buffer size is equal to the CTU size        -   k. In one example, M=mW and N=H, where W and H are width and            height of a CTU, m is a positive integer.        -   l. In one example, M=W and N=nH, where W and H are width and            height of a CTU, n is a positive integer.        -   m. In one example, M=mW and N=nH, where W and H are width            and height of a CTU, m and n are positive integers.        -   n. In above example, m and n may depend on CTU size.            -   i. In one example, when CTU size is 128×128, m=1 and                n=1.            -   ii. In one example, when CTU size is 64×64, m=4 and n=1.            -   iii. In one example, when CTU size is 32×32, m=16 and                n=1.            -   iv. In one example, when CTU size is 16×16, m=64 and                n=1.        -   o. Alternatively, the buffer size corresponds to CTU size.        -   p. Alternatively, the buffer size corresponds to a Virtual            Pipeline Data Unit (VPDU) size.        -   q. M and/or N may be signaled from the encoder to the            decoder, such as in VPS/SPS/PPS/picture header/slice            header/tile group header.    -   2. M and/or N may be different in different        profiles/levels/tiers defined in a standard. It is proposed to        use another Mc×Nc pixel buffer to store the chroma reference        samples for CPR/IBC.        -   a. In one example, Mc=M/2 and Nc=N/2 for 4:2:0 video        -   b. In one example, Mc=M and Nc=N for 4:4:4 video        -   c. In one example, Mc=M and Nc=N/2 for 4:2:2 video        -   d. Alternatively, Mc and Nc can be independent of M and N.        -   e. In one example, the chroma buffer includes two channels,            corresponding to Cb and Cr.        -   f. In one example, Mc=M and Nc=N.    -   3. It is proposed to use a M×N sample buffer to store the RGB        reference samples for CPR/IBC        -   a. In one example, the buffer size is 64×64.        -   b. In one example, the buffer size is 128×128.        -   c. In one example, the buffer size is 64×128.        -   d. In one example, the buffer size is 128×64.        -   e. Alternatively, the buffer size corresponds to CTU size.        -   f. Alternatively, the buffer size corresponds to a Virtual            Pipeline Data Unit (VPDU) size.    -   4. It is proposed that the buffer can store reconstructed pixels        before loop-filtering. Loop-filtering may refer to deblocking        filter, adaptive loop filter (ALF), sample adaptive offset        (SAO), a cross-component ALF, or any other filters.        -   a. In one example, the buffer can store samples in the            current CTU.        -   b. In one example, the buffer can store samples outside of            the current CTU.        -   c. In one example, the buffer can store samples from any            part of the current picture.        -   d. In one example, the buffer can store samples from other            pictures.    -   5. It is proposed that the buffer can store reconstructed pixels        after loop-filtering. Loop-filtering may refer to deblocking        filter, adaptive loop filter (ALF), sample adaptive offset        (SAO), a cross-component ALF, or any other filters.        -   a. In one example, the buffer can store samples in the            current CTU.        -   b. In one example, the buffer can store samples outside of            the current CTU.        -   c. In one example, the buffer can store samples from any            part of the current picture.        -   d. In one example, the buffer can store samples from other            pictures.    -   6. It is proposed that the buffer can store both reconstructed        samples before loop-filtering and after loop-filtering.        Loop-filtering may refer to deblocking filter, adaptive loop        filter (ALF), sample adaptive offset (SAO), a cross-component        ALF, or any other filters.        -   a. In one example, the buffer can store both samples from            the current picture and samples from other pictures,            depending on the availability of those samples.        -   b. In one example, reference samples from other pictures are            from reconstructed samples after loop-filtering.        -   c. In one example, reference samples from other pictures are            from reconstructed samples before loop-filtering.    -   7. It is proposed that the buffer stores samples with a given        bit-depth which may be different from the bit-depth for coded        video data.        -   a. In one example, the bit-depth for the reconstruction            buffer/coded video data is larger than that for IBC            reference samples stored in the buffer.        -   b. In one example, even when the internal bit-depth is            different from the input bit-depth for a video sequence,            such as (10 bits vs 8 bits), the IBC reference samples are            stored to be aligned with the input bit-depth.        -   c. In one example, the bit-depth is identical to that of the            reconstruction buffer.        -   d. In one example, the bit-depth is identical to that of            input image/video.        -   e. In one example, the bit-depth is identical to a predefine            number.        -   f. In one example, the bit-depth depends on profile of a            standard.        -   g. In one example, the bit-depth or the bit-depth difference            compared to the output bit-depth/input bit-depth/internal            bit-depth may be signalled in SPS/PPS/sequence            header/picture header/slice header/Tile group header/Tile            header or other kinds of video data units.        -   h. The proposed methods may be applied with the proposed            buffer definitions mentioned in other bullets,            alternatively, they may be also applicable to existing            design of IBC.        -   i. The bit-depth of each color component of the buffer may            be different.            Buffer Initiation    -   8. It is proposed to initialize the buffer with a given value        -   a. In one example, the buffer is initialized with a given            value.            -   i. In one example, the given value may depend on the                input bit-depth and/or internal bit-depth.            -   ii. In one example, the buffer is initialized with                mid-grey value, e.g. 128 for 8-bit signal or 512 for                10-bit signal.            -   iii. In one example, the buffer is initialized with                forwardLUT (m) when ILR is used. E.g. m=1<<(Bitdepth-1).        -   b. Alternatively, the buffer is initialized with a value            signalled in SPS/VPS/APS/PPS/sequence header/Tile group            header/Picture header/tile/CTU/Coding unit/VPDU/region.        -   c. In one example, the given value may be derived from            samples of previously decoded pictures or slices or CTU rows            or CTUs or CUs.        -   d. The given value may be different for different color            component    -   9. Alternatively, it is proposed to initialize the buffer with        decoded pixels from previously coded blocks.        -   a. In one example, the decoded pixels are those before            in-loop filtering.        -   b. In one example, when the buffer size is a CTU, the buffer            is initialized with decoded pixels of the previous decoded            CTU, if available.        -   c. In one example, when the buffer size is of 64×64, its            buffer size is initialized with decoded pixels of the            previous decoded 64×64 block, if available.        -   d. Alternatively, furthermore, if no previously coded blocks            are available, the methods in bullet 8 may be applied.            Reference to the Buffer    -   10. For a block to use pixels in the buffer as reference, it can        use a position (x,y), x=0,1,2, . . . ,M−1; y=0, 1, 2, . . . ,        N−1, within the buffer to indicate where to get reference.    -   11. Alternatively, the reference position can be denoted as        l=y*M+x, l=0, 1, . . . , M*N−1.    -   12. Denote that the upper-left position of a block related to        the current CTU as (x0, y0), a block vector (BVx, BVy)=(x-x0,        y-y0) may be sent to the decoder to indicate where to get        reference in the buffer.    -   13. Alternatively, a block vector (BVx, BVy) can be defined as        (x-x0+Tx, y-y0+Ty) where Tx and Ty are predefined offsets.    -   14. For any pixel (x0, y0) and (BVx, BVy), its reference in the        buffer can be found at (x0+ BVx, y0+ BVy)        -   a. In one example, when (x0+ BVx, y0+ BVy) is outside of the            buffer, it will be clipped to the boundary.        -   b. Alternatively, when (x0+ BVx, y0+ BVy) is outside of the            buffer, its reference value is predefined as a given value,            e.g. mid-grey.        -   c. Alternatively, the reference position is defined as ((x0+            BVx) mod M, (y0+ BVy) mod N) so that it is always within the            buffer.    -   15. For any pixel (x0, y0) and (BVx, BVy), when (x0+ BVx, y0+        BVy) is outside of the buffer, its reference value may be        derived from the values in the buffer.        -   a. In one example, the value is derived from the sample            ((x0+ BVx) mod M, (y0+ BVy) mod N) in the buffer.        -   b. In one example, the value is derived from the sample            ((x0+ BVx) mod M, clip (y0+ BVy, 0, N−1)) in the buffer.        -   c. In one example, the value is derived from the sample            (clip (x0+ BVx, 0, M−1), (y0+ BVy) mod N) in the buffer.        -   d. In one example, the value is derived from the sample            (clip (x0+ BVx, 0, M−1), clip (y0+ BVy, 0, N−1)) in the            buffer.    -   16. It may disallow a certain coordinate outside of the buffer        range        -   a. In one example, for any pixel (x0, y0) relative to the            upperleft corner of a CTU and block vector (BVx, BVy), it is            a bitstream constraint that y0+ BVy should be in the range            of [0, . . . , N−1].        -   b. In one example, for any pixel (x0, y0) relative to the            upperleft corner of a CTU and block vector (BVx, BVy), it is            a bitstream constraint that x0+ BVx should be in the range            of [0, . . . , M−1].        -   c. In one example, for any pixel (x0, y0) relative to the            upperleft corner of a CTU and block vector (BVx, BVy), it is            a bitstream constraint that both y0+ BVy should be in the            range of [0, . . . , N−1] and x0+ BVx should be in the range            of [0, . . . , M−1].    -   17. When the signalled or derived block vector of one block        points to somewhere outside the buffer, padding may be applied        according to the buffer.        -   a. In one example, the value of any sample outside of the            buffer is defined with a predefined value.            -   i. In one example, the value can be 1<<(Bitdepth−1),                e.g. 128 for 8-bit signals and 512 for 10-bit signals.            -   ii. In one example, the value can be forwardLUT (m) when                ILR is used. E.g. m=1<<(Bitdepth−1).            -   iii. Alternatively, indication of the predefined value                may be signalled or indicated at SPS/PPS/sequence                header/picture header/slice header/Tile                group/Tile/CTU/CU level.        -   b. In one example, any sample outside of the buffer is            defined as the value of the nearest sample in the buffer.    -   18. The methods to handle out of the buffer reference may be        different horizontally and vertically or may be different        according to the location of the current block (e.g., closer to        picture boundary or not).        -   a. In one example, when y0+ BVy is outside of [0, N−1], the            sample value of (x0+ BVx, y0+ BVy) is assigned as a            predefined value.        -   b. In one example, when x0+ BVx is outside of [0, M−1], the            sample value of (x0+ BVx, y0+ BVy) is assigned as a            predefined value.        -   c. Alternatively, the sample value of (x0+ BVx, y0+ BVy) is            assigned as the sample value of ((x0+ BVx) mod M, y0+ BVy),            which may invoke other method to further derive the value if            ((x0+ BVx) mod M, y0+ BVy) is still outside of the buffer.        -   d. Alternatively, the sample value of (x0+ BVx, y0+ BVy) is            assigned as the sample value of (x0+ BVx, (y0+ BVy) mod N),            which may invoke other method to further derive the value if            (x0+ BVx, (y0+ BVy) mod N) is still outside of the buffer.            Block Vector Representation    -   19. Each component of a block vector (BVx, BVy) or one of the        component may be normalized to a certain range.        -   a. In one example, BVx can be replaced by (BVx mod M).        -   b. Alternatively, BVx can be replaced by ((BVx+X) mod M)-X,            where X is a predefined value.            -   i. In one example, X is 64.            -   ii. In one example, X is M/2;            -   iii. In one example, X is the horizontal coordinate of a                block relative to the current CTU.        -   c. In one example, BVy can be replaced by (BVy mod N).        -   d. Alternatively, BVy can be replaced by ((BVy+Y) mod N)-Y,            where Y is a predefined value.            -   i. In one example, Y is 64.            -   ii. In one example, Y is N/2;            -   iii. In one example, Y is the vertical coordinate of a                block relative to the current CTU.    -   20. BVx and BVy may have different normalized ranges.    -   21. A block vector difference (BVDx, BVDy) can be normalized to        a certain range.        -   a. In one example, BVDx can be replaced by (BVDx mod M)            wherein the function mod returns the reminder.        -   b. Alternatively, BVDx can be replaced by ((BVDx+X) mod            M)-X, where X is a predefined value.            -   i. In one example, X is 64.            -   ii. In one example, X is M/2;        -   c. In one example, BVy can be replaced by (BVDy mod N).        -   d. Alternatively, BVy can be replaced by ((BVDy+Y) mod N)-Y,            where Y is a predefined value.            -   i. In one example, Y is 64.            -   ii. In one example, Y is N/2;    -   22. BVDx and BVDy may have different normalized ranges.        Validity Check for a Block Vector

Denote the width and height of an IBC buffer as W_(buf) and H_(buf). Fora W×H block (may be a luma block, chroma block, CU, TU, 4×4, 2×2, orother subblocks) starting from (X, Y) relative to the upper-left cornerof a picture, the following may apply to tell if a block vector (BVx,BVy) is valid or not. Let W_(pic) and H_(pic) be the width and height ofa picture and; W_(ctu) and H_(ctu) be the width and height of a CTU.Function floor(x) returns the largest integer no larger than x. Functionis Rec (x, y) returns if sample (x, y) has been reconstructed.

-   -   23. Block vector (BVx, BVy) may be set as valid even if any        reference position is outside of picture boundary.        -   a. In one example, the block vector may be set as valid even            if X+ BVx<0.        -   b. In one example, the block vector may be set as valid even            if X+W+ BVx> W_(pic).        -   c. In one example, the block vector may be set as valid even            if Y+ BVy<0.        -   d. In one example, the block vector may be set as valid even            if Y+H+ BVy> H_(pic).    -   24. Block vector (BVx, BVy) may be set as valid even if any        reference position is outside of the current CTU row.        -   a. In one example, the block vector may be set as valid even            if Y+ BVy<floor(Y/H_(ctu))*H_(ctu).        -   b. In one example, the block vector may be set as valid even            if Y+H+ BVy>=floor(Y/H_(ctu))*H_(ctu)+H_(ctu).    -   25. Block vector (BVx, BVy) may be set as valid even if any        reference position is outside of the current and left (n−1)        CTUs, where n is the number of CTUs (including or excluding the        current CTU) that can be used as reference area for IBC.        -   a. In one example, the block vector may be set as valid even            if X+ BVx<floor(X/W_(ctu))*W_(ctu)-(n−1)*W_(ctu).        -   b. In one example, the block vector may be set as valid even            if X+W+ BVx> floor(X/W_(ctu))*W_(ctu)+W_(ctu)    -   26. Block vector (BVx, BVy) may be set as valid even if a        certain sample has not been reconstructed.        -   a. In one example, the block vector may be set as valid even            if isRec (X+ BVx, Y+ BVy) is false.        -   b. In one example, the block vector may be set as valid even            if isRec (X+ BVx+W−1, Y+ BVy) is false.        -   c. In one example, the block vector may be set as valid even            if isRec (X+ BVx, Y+ BVy+H−1) is false.        -   d. In one example, the block vector may be set as valid even            if isRec (X+ BVx+W−1, Y+ BVy+H−1) is false.    -   27. Block vector (BVx, BVy) may be always set as valid when a        block is not of the 1^(st) CTU in a CTU row.        -   a. Alternatively, the block vector may be always set as            valid.    -   28. Block vector (BVx, BVy) may be always set as valid when the        following 3 conditions are all satisfied        X+BVx>=0        Y+BVy>=floor(Y/H _(ctu))        isRec(X+BVx+W−1,Y+BVy+H−1)==true    -   a. Alternatively, when the three conditions are all satisfied        for a block of the 1^(st) CTU in a CTU row, the block vector may        be always set as valid.    -   29. When a block vector (BVx, BVy) is valid, sample copying for        the block may be based on the block vector.        -   a. In one example, prediction of sample (X, Y) may be from            ((X+ BVx) % W_(buf), (Y+ BVy) % H_(buf))            Buffer Update    -   30. When coding a new picture or tile, the buffer may be reset.        -   a. The term “reset” may refer that the buffer is            initialized.        -   b. The term “reset” may refer that all samples/pixels in the            buffer is set to a given value (e.g., 0 or −1).    -   31. When finishing coding of a VPDU, the buffer may be updated        with the reconstructed values of the VPDU.    -   32. When finishing coding of a CTU, the buffer may be updated        with the reconstructed values of the CTU.        -   a. In one example, when the buffer is not full, the buffer            may be updated CTU by CTU sequentially.        -   b. In one example, when the buffer is full, the buffer area            corresponding to the oldest CTU will be updated.        -   c. In one example, when M=mW and N=H(W and H are CTU size; M            and N are the buffer size) and the previous updated area            started from (kW, 0), the next starting position to update            will be ((k+1) W mod M, 0).    -   33. The buffer can be reset at the beginning of each CTU row.        -   a. Alternatively, the buffer may be reset at the beginning            of decoding each CM.        -   b. Alternatively, the buffer may be reset at the beginning            of decoding one tile.        -   c. Alternatively, the buffer may be reset at the beginning            of decoding one tile group/picture.    -   34. When finishing coding a block starting from (x,y), the        buffer's corresponding area, starting from (x,y) will be updated        with reconstruction from the block.        -   a. In one example, (x,y) is a position relative to the            upper-left corner of a CTU.    -   35. When finishing coding a block relative to the picture, the        buffer's corresponding area will be updated with reconstruction        from the block.        -   a. In one example, the value at position (x mod M, y mod N)            in the buffer may be updated with the reconstructed pixel            value of position (x, y) relative to the upper-left corner            of the picture.        -   b. In one example, the value at position (x mod M, y mod N)            in the buffer may be updated with the reconstructed pixel            value of position (x, y) relative to the upper-left corner            of the current tile.        -   c. In one example, the value at position (x mod M, y mod N)            in the buffer may be updated with the reconstructed pixel            value of position (x, y) relative to the upper-left corner            of the current CTU row.        -   d. In one example, the value in the buffer may be updated            with the reconstructed pixel values after bit-depth            alignment.    -   36. When finishing coding a block starting from (x,y), the        buffer's corresponding area, starting from (xb,yb) will be        updated with reconstruction from the block wherein (xb, yb) and        (x, y) are two different coordinates        -   a. In one example, (x,y) is a position related to the            upper-left corner of a CM, and (xb, yb) is (x+ update x, y+            update_y), wherein update_x and update_y point to a            updatable position in the buffer.    -   37. For above examples, the reconstructed values of a block may        indicate the reconstructed values before filters (e.g.,        deblocking filter) applied.        -   a. Alternatively, the reconstructed values of a block may            indicate the reconstructed values after filters (e.g.,            deblocking filter) applied.    -   38. When the buffer is updated from reconstructed samples, the        reconstructed samples may be firstly modified before being        stored, such as sample bit-depth can be changed.        -   a. In one example, the buffer is updated with reconstructed            sample value after bit-depth alignment to the bitdepth of            the buffer.        -   b. In one example, the buffer value is updated according to            the value {p+[1<<(b−1)]}>> b, where p is reconstructed            sample value, b is a predefined bit-shifting value.        -   c. In one example, the buffer value is updated according to            the value clip ({p+[1<<(b−1)]}>> b, 0, (1<<bitdepth)−1),            where p is reconstructed sample value, b is a predefined            bit-shifting value, bitdepth is the buffer bit-depth.        -   d. In one example, the buffer value is updated according to            the value {p+[1<<(b−1)−1]}>> b, where p is reconstructed            sample value, b is a predefined bit-shifting value.        -   e. In one example, the buffer value is updated according to            the value clip ({p+[1<<(b−1)−1]}>> b, 0, (1<<bitdepth)−1),            where p is reconstructed sample value, b is a predefined            bit-shifting value, bitdepth is the buffer bit-depth.        -   f. In one example, the buffer value is updated according to            the value p>> b.        -   g. In one example, the buffer value is updated according to            the value clip (p>> b, 0, (1<<bitdepth)−1), where bitdepth            is the buffer bit-depth.        -   h. In the above examples, b can be reconstructed bit-depth            minus input sample bit-depth.    -   39. When use the buffer samples to form prediction, a        preprocessing can be applied.        -   a. In one example, the prediction value is p<<b, where p is            a sample value in the buffer, and b is a predefined value.        -   b. In one example, the prediction value is clip (p<<b, 0,            1<<bitdepth), where bitdepth is the bit-depth for            reconstruction samples.        -   c. In one example, the prediction value is            (p<<b)+(1<(bitdepth−1)), where p is a sample value in the            buffer, and b is a predefined value, bitdepth is the            bit-depth for reconstruction samples.        -   d. In the above examples, b can be reconstructed bit-depth            minus input sample bit-depth.    -   40. The buffer can be updated in a given order.        -   a. In one example, the buffer can be updated sequentially.        -   b. In one example, the buffer can be updated according to            the order of blocks reconstructed.    -   41. When the buffer is full, the samples in the buffer can be        replaced with latest reconstructed samples.        -   a. In one example, the samples can be updated in a            first-in-first-out manner.        -   b. In one example, the oldest samples will be replaced.        -   c. In one example, the samples can be assigned a priority            and replaced according to the priority.        -   d. In one example, the samples can be marked as “long-term”            so that other samples will be replaced first.        -   e. In one example, a flag can be sent along with a block to            indicate a high priority.        -   f. In one example, a number can be sent along with a block            to indicate priority.        -   g. In one example, samples from a reconstructed block with a            certain characteristic will be assign a higher priority so            that other samples will be replace first.            -   i. In one example, when the percentage of samples coded                in IBC mode is larger than a threshold, all samples of                the block can be assigned a high priority.            -   ii. In one example, when the percentage of samples coded                in Palette mode is larger than a threshold, all samples                of the block can be assigned a high priority.            -   iii. In one example, when the percentage of samples                coded in IBC or Palette mode is larger than a threshold,                all samples of the block can be assigned a high                priority.            -   iv. In one example, when the percentage of samples coded                in transform-skip mode is larger than a threshold, all                samples of the block can be assigned a high priority.            -   v. The threshold can be different according to                block-size, color component, CTU size.            -   vi. The threshold can be signalled in SPS/PPS/sequence                header/slice header/Tile group/Tile level/a region.        -   h. In one example, that buffer is full may mean that the            number of available samples in the buffer is equal or larger            than a given threshold.            -   i. In one example, when the number of available samples                in the buffer is equal or larger than 64×64×3 luma                samples, the buffer may be determined as full.                Alternative Buffer Combination    -   42. Instead of always using the previously coded three 64×64        blocks as a reference region, it is proposed to adaptively        change it based on current block (or VPDU)'s location.        -   a. In one example, when coding/decoding a 64×64 block,            previous 3 64×64 blocks can be used as reference. Compared            to FIG. 2 , more kinds of combination of previous 64×64            blocks can be applied. FIG. 2 shows an example of a            different combination of previous 64×64 blocks.    -   43. Instead of using the z-scan order, vertical scan order may        be utilized instead.        -   a. In one example, when one block is split into 4 VPDUs with            index 0 . . . 3 in z-scan order, the encoding/decoding order            is 0, 2, 1, 3.        -   b. In one example, when coding/decoding a 64×64 blocks,            previous 3 64×64 blocks can be used as reference. Compared            to FIG. 2 , more kind of coding/decoding orders of 64×64            blocks can be applied. FIG. 4 shows an example of a            different coding/decoding order of 64×64 blocks.        -   c. Alternatively, above methods may be applied only for            screen content coding        -   d. Alternatively, above methods may be applied only when CPR            is enabled for one tile/tile group/picture.        -   e. Alternatively, above methods may be applied only when CPR            is enabled for one CTU or one CTU row.            Virtual IBC Buffer

The following, the width and height of a VPDU is denoted as W_(VPDU)(e.g., 64) and H_(VPDU) (e.g., 64), respectively in luma samples.Alternatively, W_(VPDU) and/or H_(VPDU) may denote the width and/orheight of other video unit (e.g., CTU).

-   -   44. A virtual buffer may be maintained to keep track of the IBC        reference region status.        -   a. In one example, the virtual buffer size is m W_(VPDU)×n            H_(VPDU).            -   i. In one example, m is equal to 3 and n is equal to 2.            -   ii. In one example, m and/or n may depend on the picture                resolution, CTU sizes.            -   iii. In one example, m and/or n may be signaled or                pre-defined.        -   b. In one example, the methods described in above bullets            and sub-bullets may be applied to the virtual buffer.        -   c. In one example, a sample (x, y) relative to the            upper-left corner of the picture/slice/tile/brick may be            mapped to (x % (mW_(VPDU)), y % (nH_(VPDU)))    -   45. An array may be used to track the availability of each        sample associated with the virtual buffer.        -   a. In one example, a flag may be associated with a sample in            the virtual buffer to specify if the sample in the buffer            can be used as IBC reference or not.        -   b. In one example, each 4×4 block containing luma and chroma            samples may share a flag to indicate if any samples            associated with that block can be used as IBC reference or            not        -   c. In one example, an array corresponding to 3×2 VPDUs            (e.g., each 4×4 block may share the same availability flag)            maintained to track availability of IBC reference samples.        -   d. In one example, an array corresponding to 4×2 VPDUs            (e.g., each 4×4 block may share the same availability flag)            maintained to track availability of IBC reference samples.    -   46. After finishing decoding a VPDU or a video unit, certain        samples associated with the virtual buffer may be marked as        unavailable for IBC reference.        -   a. In one example, which samples may be marked as            unavailable depend on the position of the most recently            decoded VPDU.        -   b. When one sample is marked unavailable, prediction from            the sample is disallowed.            -   i. Alternatively, other ways (e.g., using default                values) may be further applied to derive a predictor to                replace the unavailable sample.    -   47. The position of most recently decoded VPDU may be recorded        to help to identify which samples associated with the virtual        buffer may be marked as unavailable.        -   a. In one example, at the beginning of decoding a VPDU,            certain samples associated with the virtual buffer may be            marked as unavailable according to the position of most            recently decoded VPDU.            -   i. In one example, denote (xPrevVPDU, yPrevVPDU) as the                upper-left position relative to the upper-left corner of                the picture/slice/tile/brick/other video processing unit                of most recently decoded VPDU, if yPrevVPDU % (n                H_(VPDU)) is equal to 0, certain positions (x, y) may be                marked as unavailable.                -   1. In one example, x may be within a range, such as                    [xPrevVPDU−2W_(VPDU)+2 mW_(VPDU)) % mW_(VPDU),                    ((xPrevVPDU−2 W_(VPDU)+2m W_(VPDU))%                    mW_(VPDU))−1+W_(VPDU)];                -   2. In one example, y may be within a range, such as                    [yPrevVPDU % (n H_(VPDU)), (yPrevVPDU %                    (nH_(VPDU)))−1+H_(VPDU)];                -   3. In one example, x may be within a range, such as                    [xPrevVPDU−2W_(VPDU)+2 mW_(VPDU)) % mW_(VPDU),                    ((xPrevVPDU−2W_(VPDU)+2 mW_(VPDU)) %                    mW_(VPDU))−1+W_(VPDU)] and y may be within a range,                    such as [yPrevVPDU % (n H_(VPDU)), (yPrevVPDU % (n                    H_(VPDU)))−1+H_(VPDU)].            -   ii. In one example, denote (xPrevVPDU, yPrevVPDU) as the                upper-left position relative to the upper-left corner of                the picture/slice/tile/brick/other video processing unit                of most recently decoded VPDU, if yPrevVPDU % (n                H_(VPDU)) is not equal to 0, certain positions (x, y)                may be marked as unavailable.                -   1. In one example, x may be within a range, such as                    [xPrevVPDU−W_(VPDU)+2 mW_(VPDU)) % MW_(VPDU),                    ((xPrevVPDU−W_(VPDU)+2 mW_(VPDU)) %                    mW_(VPDU))−1+W_(VPDU)];                -   2. In one example, y may be within a range, such as                    [yPrevVPDU % (n H_(VPDU)), (yPrevVPDU % (n                    H_(VPDU)))−1+H_(VPDU)]                -   3. In one example, x may be within a range, such as                    [xPrevVPDU−W_(VPDU)+2 mW_(VPDU)) % mW_(VPDU),                    ((xPrevVPDU−W_(VPDU)+2 mW_(VPDU)) %                    mW_(VPDU))−1+W_(VPDU)] and y may be within a range,                    such as [yPrevVPDU % (n H_(VPDU)), (yPrevVPDU % (n                    H_(VPDU)))−1+H_(VPDU)].    -   48. When a CU contains multiple VPDUs, instead of applying IBC        reference availability marking process according to VPDU, the        IBC reference availability marking process may be according to        the CU        -   a. In one example, at the beginning of decoding a CU            containing multiple VPDUs, the IBC reference availability            marking process may be applied for each VPDU before the VPDU            within the CU is decoded.        -   b. In such a case, 128×64 and 64×128 IBC blocks may be            disallowed.            -   i. In one example, pred_mode_ibc_flag for 128×64 and                64×128 CUs may not be sent and may be inferred to equal                to 0.    -   49. For a reference block or sub-block, the reference        availability status of the upper-right corner may not need to be        checked to tell if the block vector associated with the        reference block is valid or not.        -   a. In one example, only the upper-left, bottom-left and            bottom-right corner of a block/sub-block will be checked to            tell if the block vector is valid or not.    -   50. The IBC buffer size may depend on VPDU size (wherein the        width/height is denoted by vSize) and/or CTB/CTU size (wherein        the width/height is denoted by ctbSize)        -   a. In one example, the height of the buffer may be equal to            ctbSize.        -   b. In one example, the width of the buffer may depend on            min(ctbSize, 64)            -   i. In one example, the width of the buffer may be                (128*128/vSize, min(ctbSize, 64))    -   51. An IBC buffer may contain values outside of pixel range,        which indicates that the position may not be available for IBC        reference, e.g., not utilized for predicting other samples.        -   a. A sample value may be set to a value which indicates the            sample is unavailable.        -   b. In one example, the value may be −1.        -   c. In one example, the value may be any value outside of [0,            1<<(internal bit depth)−1] wherein internal_bit_depth is a            positive integer value. For example, internal_bit_depth is            the internal bitdepth used for encoding/decoding a sample            for a color component.        -   d. In one example, the value may be any value outside of [0,            1<<(input_bit_depth)−1] wherein input_bit_depth is a            positive integer value. For example, input_bit_depth is the            input bitdepth used for encoding/decoding a sample for a            color component.    -   52. Availability marking for samples in the IBC buffer may        depend on position of the current block, size of the current        block, CTU/CTB size and VPDU size. In one example, let (xCb,        yCb) denotes the block's position relative to top-left of the        picture; ctbSize is the size (i. e., width and/or height) of a        CTU/CTB; vSize=min(ctbSize, 64); wIbcBuf and hIbcBuf are the IBC        buffer width and height.        -   a. In one example, if (xCb % vSize) is equal to 0 and (yCb %            vSize) is equal to 0, a certain set of positions in the IBC            buffer may be marked as unavailable.        -   b. In one example, when the current block size is smaller            than the VPDU size, i.e. min(ctbSize, 64), the region marked            as unavailable may be according to the VPDU size.        -   c. In one example, when the current block size is larger            than the VPDU size, i.e. min(ctbSize, 64), the region marked            as unavailable may be according to the CU size.    -   53. At the beginning of decoding a video unit (e.g., VPDU (xV,        yV)) relative to the top-left position of a picture,        corresponding positions in the IBC buffer may be set to a value        outside of pixel range.        -   a. In one example, buffer samples with position (x %            wIbcBuf, y % hIbcBuf) in the buffer, with x=xV, . . . , xV+            ctbSize−1 and y=yV, . . . , yV+ ctbSize−1, will be set to            value −1. Where wIbcBuf and hIbcBuf are the IBC buffer width            and height, ctbSize is the width of a CTU/CTB.            -   i. In one example, hIbcBuf may be equal to ctbSize.    -   54. A bitstream conformance constraint may be according to the        value of a sample in the IBC buffer        -   a. In one example, if a reference block associated with a            block vector in IBC buffer contains value outside of pixel            range, the bitstream may be illegal.    -   55. A bitstream conformance constraint may be set according to        the availability indication in the IBC buffer.        -   a. In one example, if any reference sample mapped in the IBC            buffer is marked as unavailable for encoding/decoding a            block, the bitstream may be illegal.        -   b. In one example, when singletree is used, if any luma            reference sample mapped in the IBC buffer for            encoding/decoding a block is marked as unavailable, the            bitstream may be illegal.        -   c. A conformance bitstream may satisfy that for an IBC coded            block, the associated block vector may point to a reference            block mapped in the IBC buffer and each luma reference            sample located in the IBC buffer for encoding/decoding a            block shall be marked as available (e.g., the values of            samples are within the range of [K0, K1] wherein for            example, K0 is set to 0 and K1 is set to (1<<BitDepth−1)            wherein BitDepth is the internal bit-depth or the input            bit-depth).    -   56. Bitstream conformance constraints may depend on partitioning        tree types and current CU's coding treeType        -   a. In one example, if dualtree is allowed in high-level            (e.g., slice/picture/brick/tile) and the current video block            (e.g., CU/PU/CB/PB) is coded with single tree, bitstreams            constraints may need to check if all components' positions            mapped in the IBC buffer is marked as unavailable or not.        -   b. In one example, if dualtree is allowed in high-level            (e.g., slice/picture/brick/tile) and the current luma video            block (e.g., CU/PU/CB/PB) is coded with dual tree,            bitstreams constraints may neglect chroma components'            positions mapped in the IBC buffer is marked as unavailable            or not.            -   i. Alternatively, in such a case, bitstreams constraints                may still check all components' positions mapped in the                IBC buffer is marked as unavailable or not.        -   c. In one example, if single tree is used, bitstreams            constraints may neglect chroma components' positions mapped            in the IBC buffer is marked as unavailable or not.            Improvement to the Current VTM Design    -   57. The prediction for IBC can have a lower precision than the        reconstruction.        -   a. In one example, the prediction value is according to the            value clip {{p+[1<<(b−1)]}>> b,0,(1<<bitdepth)−1}<<b, where            p is reconstructed sample value, b is apredefined            bit-shifting value, bitdepth is prediction sample            bit-bitdepth.        -   b. In one example, the prediction value is according to the            value clip {{p+[1<<(b−1)−1]}>> b,0,(1<<bitdepth)−1}<<b,            where p is reconstructed sample value, b is a predefined            bit-shifting value.        -   c. In one example, the prediction value is according to the            value ((p>> b)+(1<<(bitdepth−1)))<<b, where bitdepth is            prediction sample bit-bitdepth.        -   d. In one example, the prediction value is according to the            value (clip ((p>>            b),0,(1<<(bitdepth−b)))+(1<<(bitdepth−1)))<<b, where            bitdepth is prediction sample bit-bitdepth.        -   e. In one example, the prediction value is clipped in            different ways depending on whether ILR is applied or not.        -   f. In the above examples, b can be reconstructed bit-depth            minus input sample bit-depth.        -   g. In one example, the bit-depth or the bit-depth difference            compared to the output bit-depth/input bit-depth/internal            bit-depth may be signalled in SPS/PPS/sequence            header/picture header/slice header/Tile group header/Tile            header or other kinds of video data units.    -   58. Part of the prediction of IBC can have a lower precision and        the other part has the same precision as the reconstruction.        -   a. In one example, the allowed reference area may contain            samples with different precisions (e.g., bit-depth).        -   b. In one example, reference from other 64×64 blocks than            the current 64×64 block being decoded is of low precision            and reference from the current 64×64 block has the same            precision as the reconstruction.        -   c. In one example, reference from other CTUs than the            current CTU being decoded is of low precision and reference            from the current CTU has the same precision as the            reconstruction.        -   d. In one example, reference from a certain set of color            components is of low precision and reference from the other            color components has the same precision as the            reconstruction    -   59. When CTU size is M×M and reference area size is nM×nM, the        reference area is the nearest available n×n CTU in a CTU row.        -   a. In one example, when reference area size is 128×128 and            CTU size is 64×64, the nearest available 4 CTUs in a CTU row            can be used for IBC reference.        -   b. In one example, when reference area size is 128×128 and            CTU size is 32×32, the nearest available 16 CTUs in a CTU            row can be used for IBC reference.    -   60. When CTU size is M and reference area size is nM, the        reference area is the nearest available n−1 CTUs in a CTU        row/tile.        -   a. In one example, when reference area size is 128×128 or            256×64 and CTU size is 64×64, the nearest available 3 CTUs            in a CTU row can be used for IBC reference.        -   b. In one example, when reference area size is 128×128 or            512×32 and CTU size is 32×32, the nearest available 15 CTUs            in a CTU row can be used for IBC reference.    -   61. When CTU size is M, VPDU size is kM and reference area size        is nM, and the reference area is the nearest available n-k CTUs        in a CTU row/tile.        -   a. In one example, CTU size is 64×64, VPDU size is also            64×64, reference are size is 128×128, the nearest 3 CTUs in            a CTU row can be used for IBC reference.        -   b. In one example, CTU size is 32×32, VPDU size is also            64×64, reference are size is 128×128, the nearest (16−4)=12            CTUs in a CTU row can be used for IBC reference.    -   62. For a w×h block with upper-left corner being (x, y) using        IBC, there are constraints that keep reference block from        certain area for memory reuse, wherein w and h are width and        height of the current block.        -   a. In one example, when CTU size is 128×128 and (x,            y)=(m×64,n×64), the reference block cannot overlap with the            64×64 region starting from ((m−2)×64, n×64).        -   b. In one example, when CM size is 128×128, the reference            block cannot overlap with the w×h block with upper-left            corner being (x−128, y).        -   c. In one example, when CTU size is 128×128, (x+ BVx, y+            BVy) cannot be within the w*h block with upper-left corner            being (x−128, y), where BVx and BVy denote the block vector            for the current block.        -   d. In one example, when CM size is M×M and IBC buffer size            is k×M×M, reference block cannot overlap with the w×h block            with upper-left corner being (x−k×M, y), where BVx and BVy            denote the block vector for the current block.        -   e. In one example, when CM size is M×M and IBC buffer size            is k×M×M, (x+ BVx, y+ BVy) cannot be within the w×h block            with upper-left corner being (x−k×M, y), where BVx and BVy            denote the block vector for the current block.    -   63. When CTU size is not M×M and reference area size is nM×nM,        the reference area is the nearest available n×n−1 CM in a CTU        row.        -   a. In one example, when reference area size is 128×128 and            CM size is 64×64, the nearest available 3 CTUs in a CM row            can be used for IBC reference.        -   b. In one example, when reference area size is 128×128 and            CM size is 32×32, the nearest available 15 CTUs in a CTU row            can be used for IBC reference.    -   64. For a CU within a 64×64 block starting from (2m*64, 2n*64),        i.e., a upper-left 64×64 block in a 128×128 CM, its IBC        prediction can be from reconstructed samples in the 64×64 block        starting from ((2m−2)*64, 2n*64), the 64×64 block starting from        ((2m−1)*64, 2n*64), the 64×64 block starting from ((2m−1)*64,        (2n+1)*64) and the current 64×64 block.    -   65. For a CU within a 64×64 block starting from ((2m+1)*64,        (2n+1)*64), i.e., a bottom-right 64×64 block in a 128×128 CM,        its IBC prediction can be from the current 128×128 CM.    -   66. For a CU within a 64×64 block starting from ((2m+1)*64,        2n*64), i.e., a upper-right 64×64 block in a 128×128 CM, its IBC        prediction can be from reconstructed samples in the 64×64 block        starting from ((2m−1)*64, 2n*64), the 64×64 block starting from        ((2m−1)*64, (2n+1)*64), the 64×64 block starting from (2m*64,        2n*64) and the current 64×64 block.        -   a. Alternatively, if the 64×64 block starting from (2m*64,            (2n+1)*64) has been reconstructed, the IBC prediction can be            from reconstructed samples in the 64×64 block starting from            ((2m−1)*64, 2n*64), the 64×64 block starting from (2m*64,            2n*64), the 64×64 block starting from (2m*64, (2n+1)*64) and            the current 64×64 block.    -   67. For a CU within a 64×64 block starting from (2m*64,        (2n+1)*64), i.e., a bottom-left 64×64 block in a 128×128 CM, its        IBC prediction can be from reconstructed samples in the 64×64        block starting from ((2m-1)*64, (2n+1)*64), the 64×64 block        starting from (2m*64, 2n*64); the 64×64 block starting from        ((2m+1)*64, 2n*64) and the current 64×64 block.        -   a. Alternatively, if the 64×64 block starting from            ((2m+1)*64, 2n*64) has not been reconstructed, the IBC            prediction can be from reconstructed samples in the 64×64            block starting from ((2m−1)*64, 2n*64), the 64×64 block            starting from ((2m−1)*64, (2n+1)*64), the 64×64 block            starting from (2m*64, 2n*64) and the current 64×64 block.    -   68. It is proposed to adjust the reference area based on which        64×64 blocks the current CU belongs to.        -   a. In one example, for a CU starting from (x,y), when            (y>>6)&1==0, two or up to two previous 64×64 blocks,            starting from ((x>>6<<6)−128, y>>6<<6) and ((x>>6<<6)−64,            y>>6<<6) can be referenced by IBC mode.        -   b. In one example, for a CU starting from (x,y), when            (y>>6)&1==1, one previous 64×64 block, starting from            ((x>>6<<6)−64, y>>6<<6) can be referenced by IBC mode.    -   69. For a block starting from (x,y) and with block vector (BVx,        BVy), if isRec (((x+ BVx)>>6<<6)+128−(((y+ BVy)>>6) &1)*64+(x        %64), ((y+ BVy)>>6<<6)+(y %64)) is true, the block vector is        invalid.        -   a. In one example, the block is a luma block.        -   b. In one example, the block is a chroma block in 4:4:4            format        -   c. In one example, the block contains both luma and chroma            components    -   70. For a chroma block in 4:2:0 format starting from (x,y) and        with block vector (BVx, BVy), if isRec (((x+        BVx)>>5<<5)+64−(((y+ BVy)>>5)&1)*32+(x %32), ((y+ BVy)>>5<<5)+(y        %32)) is true, the block vector is invalid.    -   71. The determination of whether a BV is invalid or not for a        block of component c may rely on the availability of samples of        component X, instead of checking the luma sample only.        -   a. For a block of component c starting from (x,y) and with            block vector (BVx, BVy), if isRec (c, ((x+            BVx)>>6<<6)+128−(((y+ BVy)>>6)&1)*64+(x %64), ((y+            BVy)>>6<<6)+(y %64)) is true, the block vector may be            treated as invalid.            -   i. In one example, the block is a luma block (e.g., c is                the luma component, or G component for RGB coding).            -   ii. In one example, the block is a chroma block in 4:4:4                format (e.g., c is the cb or cr component, or B/R                component for RGB coding).            -   iii. In one example, availability of samples for both                luma and chroma components may be checked, e.g., the                block contains both luma and chroma components        -   b. For a chroma block in 4:2:0 format starting from (x,y) of            component c and with block vector (BVx, BVy), if isRec (c,            ((x+ BVx)>>5<<5)+64−(((y+ BVy)>>5)&1)*32+(x %32), ((y+            BVy)>>5<<5)+(y %32)) is true, the block vector may be            treated as invalid.        -   c. For a chroma block or sub-block starting from (x, y) of            component c and with block vector (BVx, BVy), if isRec (c,            x+ BVx+ Chroma_CTU_size, y) for a chroma component is true,            the block vector may be treated as invalid, where            Chroma_CTU_size is the CTU size for chroma component.            -   i. In one example, for 4:2:0 format, Chroma CTU size may                be 64.            -   ii. In one example, a chroma sub-block may be a 2×2                block in 4:2:0 format.            -   iii. In one example, a chroma sub-block may be a 4×4                block in 4:4:4 format.            -   iv. In one example, a chroma sub-block may correspond to                the minimal CU size in luma component.                -   l. Alternatively, a chroma sub-block may correspond                    to the minimal CU size for the chroma component.    -   72. For all bullets mentioned above, it is assumed that the        reference buffer contains multiple M×M blocks (M=64). However,        it could be extended to other cases such as the reference buffer        contains multiple N×M blocks (e.g., N=128, M=64).    -   73. For all bullets mentioned above, further restrictions may be        applied that the reference buffer should be within the same        brick/tile/tile group/slice as the current block.        -   a. In one example, if partial of the reference buffer is            outside the current brick/tile/tile group/slice, the usage            of IBC may be disabled. The signalling of IBC related syntax            elements may be skipped.        -   b. Alternatively, if partial of the reference buffer is            outside the current brick/tile/tile group/slice, IBC may be            still enabled for one block, however, the block vector            associated with one block may only point to the remaining            reference buffer.    -   74. It is proposed to have K1 most recently coded VPDU, if        available, in the 1^(st) VPDU row of the CTU/CTB row and K2 most        recently coded VPDU, if available, in the 2^(nd) VPDU row of the        CTU/CTB row as the reference area for IBC, excluding the current        VPDU.        -   a. In one example, K1 is equal to 2 and K2 is equal to 1.        -   b. In one example, the above methods may be applied when the            CTU/CTB size is 128×128 and VPDU size is 64×64.        -   c. In one example, the above methods may be applied when the            CTU/CTB size is 64×64 and VPDU size is 64×64 and/or 32×32.        -   d. In one example, the above methods may be applied when the            CTU/CTB size is 32×32 and VPDU size is 32×32 or smaller.    -   75. The above methods may be applied in different stages.        -   a. In one example, the module operation (e.g., a mod b) of            block vectors (BVs) may be invoked in the availability check            process of BVs to decide whether the BV is valid or not.        -   b. In one example, the module operation (e.g., a mod b) of            block vectors (BVs) may be invoked to identify a reference            sample's location (e.g., according to the module results of            a current sample's location and BV) in the IBC virtual            buffer or reconstructed picture buffer (e.g., before in-loop            filtering process).

5. Embodiments 5.1 Embodiment #1

An implementation of the buffer for IBC is described below:

The buffer size is 128×128. CTU size is also 128×128. For coding of the1^(st) CTU in a CM row, the buffer is initialized with 128 (for 8-bitvideo signal). For coding of the k-th CTU in a CTU row, the buffer isinitialized with the reconstruction before loop-filtering of the(k−1)-th CTU.

FIG. 3 shows an example of coding of a block starting from (x,y).

When coding a block starting from (x,y) related to the current CTU, ablock vector (BVx, BVy)=(x−x0, y−y0) is sent to the decoder to indicatethe reference block is from (x0,y0) in the IBC buffer. Suppose the widthand height of the block are w and h respectively. When finishing codingof the block, a wxh area starting from (x,y) in the IBC buffer will beupdated with the block's reconstruction before loop-filtering.

5.2 Embodiment #2

FIG. 4 shows examples of possible alternative way to choose the previouscoded 64×64 blocks.

5.3 Embodiment #3

FIG. 5 shows an example of a possible alternative way to change thecoding/decoding order of 64×64 blocks.

5.4 Embodiment #4

FIG. 8 shows another possible alternative way to choose the previouscoded 64×64 blocks, when the decoding order for 64×64 blocks is from topto bottom, left to right.

5.5 Embodiment #5

FIG. 9 shows another possible alternative way to choose the previouscoded 64×64 blocks.

5.6 Embodiment #6

FIG. 11 shows another possible alternative way to choose the previouscoded 64×64 blocks, when the decoding order for 64×64 blocks is fromleft to right, top to bottom.

5.7 Embodiment #7

Suppose that CTU size is W×W, an implementation of IBC buffer with sizemW×W and bitdepth being B, at the decoder is as below.

At the beginning of decoding a CTU row, initialize the buffer with value(1<<(B−1)) and set the starting point to update (xb, yb) to be (0,0).

When a CU starting from (x, y) related to a CTU upper-left corner andwith size w×h is decoded, the area starting from (xb+x, yb+y) and wxhsize will be updated with the reconstructed pixel values of the CU,after bit-depth aligned to B-bit.

After a CTU is decoded, the starting point to update (xb, yb) will beset as ((xb+W) mod mW, 0).

When decoding an IBC CU with block vector (BVx, BVy), for any pixel (x,y) related to a CTU upper-left corner, its prediction is extracted fromthe buffer at position ((x+ BVx) mod mW, (y+ BVy) mode W) afterbit-depth alignment to the bit-depth of prediction signals.

In one example, B is set to 7, or 8 while the output/input bitdepth ofthe block may be equal to 10.

5.8 Embodiment #8

For a luma CU or joint luma/chroma CU starting from (x,y) related to theupper-left corner of a picture and a block vector (BVx, BVy), the blockvector is invalid when isRec (((x+ BVx)>>6<<6)+128−(((y+BVy)>>6)&1)*64+(x %64), ((y+ BVy)>>6<<6)+(y %64)) is true.

For a chroma CU starting from (x,y) related to the upper-left corner ofa picture and a block vector (BVx, BVy), the block vector is invalidwhen isRec (((x+ BVx)>>5<<5)+64−(((y+ BVy)>>5)&1)*32+(x %32), ((y+BVy)>>5<<5)+(y %32)) is true.

5.9 Embodiment #9

For a chroma block or sub-block starting from (x,y) in 4:2:0 formatrelated to the upper-left corner of a picture and a block vector (BVx,BVy), the block vector is invalid when isRec (c, (x+ BVx+64, y+ BVy) istrue, where c is a chroma component.

For a chroma block or sub-block starting from (x,y) in 4:4:4 formatrelated to the upper-left corner of a picture and a block vector (BVx,BVy), the block vector is invalid when isRec (c, (x+ BVx+128, y+ BVy) istrue, where c is a chroma component.

5.10 Embodiment #10

For a luma CU or joint luma/chroma CU starting from (x,y) related to theupper-left corner of a picture and a block vector (BVx, BVy), the blockvector is invalid when isRec (((x+ BVx)>>6<<6)+128−(((y+BVy)>>6)&1)*64+(x %64), ((y+ BVy)>>6<<6)+(y %64)) is true.

For a chroma block or sub-block starting from (x,y) in 4:2:0 formatrelated to the upper-left corner of a picture and a block vector (BVx,BVy), the block vector is invalid when isRec (c, ((x+BVx)>>5<<5)+64−(((y+ BVy)>>5)&1)*32+(x %32), ((y+ BVy)>>5<<5)+(y %32))is true, where c is a chroma component.

5.11 Embodiment #11

This embodiment highlights an implementation of keeping two most codedVPDUs in the 1^(st) VPDU row and one most coded VPDU in the 2^(nd) VPDUrow of a CTU/CTB row, excluding the current VPDU.

When VPDU coding order is top to bottom and left to right, the referencearea is illustrated as in FIG. 13 .

When VPDU coding order is left to right and top to bottom and thecurrent VPDU is not to the right side of the picture boundary, thereference area is illustrated as in FIG. 14 .

When VPDU coding order is left to right and top to bottom and thecurrent VPDU is to the right side of the picture boundary, the referencearea may be illustrated as FIG. 15 .

Given a lama block (x, y) with size wxh, a block vector (BVx, BVy) isvalid or not can be told by checking the following condition:

isRec (((x+ BVx+128)>>6<<6)−(refy&0x 40)+(x %64), ((y+BVy)>>6<<6)+(refy>>6==y>>6)?(y %64):0), where refy=(y&0x40)?(y+ BVy):(y+BVy+w−1).

If the above function returns true, the block vector (BVx, BVy) isinvalid, otherwise the block vector might be valid.

5.12 Embodiment #12

If CTU size is 192×128, a virtual buffer with size 192×128 is maintainedto track the reference samples for IBC.

A sample (x, y) relative to the upper-left corner of the picture isassociated with the position (x %192, y %128) relative to the upper-leftcorner of the buffer. The following steps show how to mark availabilityof the samples associate with the virtual buffer for IBC reference.

A position (xPrevVPDU, yPrevVPDU) relative to the upper-left corner ofthe picture is recorded to stand for the upper-left sample of the mostrecently decoded VPDU.

-   -   1) At the beginning of decoding a VPDU row, all positions of the        buffer are marked as unavailable. (xPrevVPDU, yPrevVPDU) is set        as (0,0).    -   2) At the beginning of decoding the 1st CU of a VPDU, positions        (x, y) with x=(xPrevVPDU−2WVPDU+2mWVPDU) % (mWVPDU), . . . ,        ((xPrevVPDU−2WVPDU+2mWVPDU) % (mWVPDU))−1+ WVPDU; and        y=yPrevVPDU % (nHVPDU), (yPrevVPDU % (nHVPDU))−1+ HVPDU may be        marked as unavailable. Then (xPrevVPDU, yPrevVPDU) is set as        (xCU, yCU), i.e. the upper-left position of the CU relative to        the picture.    -   3) After decoding a CU, positions (x, y) with x=xCU % (mWVPDU),        . . . , (xCU+CU_width−1) % (mWVP DU) and y=yCU % (nHVPDU), . . .        , (yCU+CU_height−1) % (nHVP DU) are marked as available.    -   4) For an IBC CU with a block vector (xBV, yBV), if any position        (x, y) with x=(xCU+ xBV) % (mWVPDU), . . . , (xCU+        xBV+CU_width−1) % (mWVPDU) and y=(yCU+ yBV) % (nHVPDU), . . . ,        (yCU+ yBV+CU_height−1) % (nHVPDU) is marked as unavailable, the        block vector is considered as invalid.

FIG. 16 shows the buffer status along with the VPDU decoding status inthe picture.

5.13 Embodiment #13

If CTU size is 128×128 or CTU size is greater than VPDU size (e.g.,64×64 in current design) or CTU size is greater than VPDU size (e.g.,64×64 in current design), a virtual buffer with size 192×128 ismaintained to track the reference samples for IBC. In the following,when a <0, (a % b) is defined as floor(a/b)*b, where floor (c) returnsthe largest integer no larger than c.

A sample (x, y) relative to the upper-left corner of the picture isassociated with the position (x % 192, y % 128) relative to theupper-left corner of the buffer. The following steps show how to markavailability of the samples associate with the virtual buffer for IBCreference.

A position (xPrevVPDU, yPrevVPDU) relative to the upper-left corner ofthe picture is recorded to stand for the upper-left sample of the mostrecently decoded VPDU.

-   -   1) At the beginning of decoding a VPDU row, all positions of the        buffer are marked as unavailable. (xPrevVPDU, yPrevVPDU) is set        as (0,0).    -   2) At the beginning of decoding the 1^(st) CU of a VPDU,        -   a. If yPrevVPDU % 64 is equal to 0, positions (x, y) with            x=(xPrevVPDU−128) % 192, . . . , ((xPrevVPDU−128) % 192)+63;            and y=yPrevVPDU % 128, . . . , (yPrevVPDU % 128)+63, are            marked as unavailable. Then (xPrevVPDU, yPrevVPDU) is set as            (xCU, yCU), i.e. the upper-left position of the CU relative            to the picture.        -   b. Otherwise, positions (x, y) with x=(xPrevVPDU−64) % 192,            ((xPrevVPDU−64) % 192)+63; and y=yPrevVPDU % 128, (yPrevVPDU            % 128)+63, are marked as unavailable. Then (xPrevVPDU,            yPrevVPDU) is set as (xCU, yCU), i.e. the upper-left            position of the CU relative to the picture.    -   3) After decoding a CU, positions (x, y) with x=xCU % 192,        (xCU+CU_width−1) % 192 and y=yCU % 128, . . . ,        (yCU+CU_height−1) % 128 are marked as available.    -   4) For an IBC CU with a block vector (xBV, yBV), if any position        (x, y) with x=(xCU+ xBV) % 192, . . . , (xCU+ xBV+CU_width−1) %        192 and y=(yCU+ yBV) % 128, . . . , (yCU+ yBV+CU_height−1) % 128        is marked as unavailable, the block vector is considered as        invalid.

If CTU size is S×S, S is not equal to 128, let Wbuf be equal to128*128/S. A virtual buffer with size Wbuf×S is maintained to track thereference samples for IBC. The VPDU size is equal to the CTU size insuch a case.

A position (xPrevVPDU, yPrevVPDU) relative to the upper-left corner ofthe picture is recorded to stand for the upper-left sample of the mostrecently decoded VPDU.

-   -   1) At the beginning of decoding a VPDU row, all positions of the        buffer are marked as unavailable. (xPrevVPDU, yPrevVPDU) is set        as (0,0).    -   2) At the beginning of decoding the 1^(st) CU of a VPDU,        positions (x, y) with x=(xPrevVPDU−W_(buf)*S) % S, . . . ,        ((xPrevVPDU−W_(buf)*S) % S)+S−1; and y=yPrevVPDU % S, . . . ,        (yPrevVPDU % S)+S−1; are marked as unavailable. Then (xPrevVPDU,        yPrevVPDU) is set as (xCU, yCU), i.e. the upper-left position of        the CU relative to the picture.    -   3) After decoding a CU, positions (x, y) with x=xCU % (W_(buf)),        . . . , (xCU+CU_width−1) % (W_(buf)) and y=yCU % S, . . . ,        (yCU+CU_height−1) % S are marked as available.    -   4) For an IBC CU with a block vector (xBV, yBV), if any position        (x, y) with x=(xCU+ xBV) % (Wbuf), . . . , (xCU+ xBV+CU_width−1)        % (Wbuf) and y=(yCU+ yBV) % S, . . . , (yCU+ yBV+CU_height−1) %        S is marked as unavailable, the block vector is considered as        invalid.

5.14 Embodiment #14

If CTU size is 128×128 or CTU size is greater than VPDU size (e.g.,64×64 in current design) or CTU size is greater than VPDU size (e.g.,64×64 in current design), a virtual buffer with size 256×128 ismaintained to track the reference samples for IBC. In the following,when a <0, (a % b) is defined as floor(a/b)*b, where floor(c) returnsthe largest integer no larger than c.

A sample (x, y) relative to the upper-left corner of the picture isassociated with the position (x % 256, y % 128) relative to theupper-left corner of the buffer. The following steps show how to markavailability of the samples associate with the virtual buffer for IBCreference.

A position (xPrevVPDU, yPrevVPDU) relative to the upper-left corner ofthe picture is recorded to stand for the upper-left sample of the mostrecently decoded VPDU.

-   -   1) At the beginning of decoding a VPDU row, all positions of the        buffer are marked as unavailable. (xPrevVPDU, yPrevVPDU) is set        as (0,0).    -   2) At the beginning of decoding the 1^(st) CU of a VPDU,        -   a. If yPrevVPDU % 64 is equal to 0, positions (x, y) with            x=(xPrevVPDU−128) % 256, . . . , ((xPrevVPDU−128) % 256)+63;            and y=yPrevVPDU % 128, . . . , (yPrevVPDU % 128)+63, are            marked as unavailable. Then (xPrevVPDU, yPrevVPDU) is set as            (xCU, yCU), i.e. the upper-left position of the CU relative            to the picture.        -   b. Otherwise, positions (x, y) with x=(xPrevVPDU−64) % 256,            . . . , ((xPrevVPDU−64) % 256)+63; and y=yPrevVPDU % 128, .            . . , (yPrevVPDU % 128)+63, are marked as unavailable. Then            (xPrevVPDU, yPrevVPDU) is set as (xCU, yCU), i.e. the            upper-left position of the CU relative to the picture.    -   3) After decoding a CU, positions (x, y) with x=xCU % 256, . . .        , (xCU+CU_width−1) % 256 and y=yCU % 128, . . . ,        (yCU+CU_height−1) % 128 are marked as available.    -   4) For an IBC CU with a block vector (xBV, yBV), if any position        (x, y) with x=(xCU+ xBV) % 256, . . . , (xCU+ xBV+CU_width−1) %        256 and (yCU+ yBV) % 128, . . . , (yCU+ yBV+CU_height−1) % 128        is marked as unavailable, the block vector is considered as        invalid.

When CTU size is not 128×128 or less than 64×64 or less than 64×64, thesame process applies as in the previous embodiment, i.e. embodiment #14.

5.15 Embodiment #15

An IBC reference availability marking process is described as follows.The changes are indicated in bolded, underlined, italicized text in thisdocument.

7.3.7.1 General Slice Data Syntax

slice_data( ) { Descriptor  for( i = 0; i < NumBricksInCurrSlice; i++ ){   CtbAddrInBs = FirstCtbAddrBs[ SliceBrickIdx[ i ] ]   for( j = 0; j <NumCtusInBrick[ SliceBrickIdx[ i ] ]; j++, CtbAddrInBs++ ) {    if( ( j% BrickWidth[ SliceBrickIdx[ i ] ] ) = = 0 ) {     NumHmvpCand = 0    NumHmvpIbcCand = 0

 

 

 

 

 

 

 

 

 

 

   }    CtbAddrInRs = CtbAddrBsToRs[ CtbAddrInBs ]    ......

 

 

 

 

 

 

 

 

 

BufWidth is equal to (CtbSizeY=128)?256:(128*128/CtbSizeY) and BufHeightis equal to CtbSizeY.

7.3.7.5 Coding Unit Syntax

coding_unit( x0, y0, cbWidth, cbHeight, treeType ) { Descriptor

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 if( slice_type != I ∥ sps_ibc_enabled_flag ) {   if( treeType !=DUAL_TREE_CHROMA &&    !( cbWidth = = 4 && cbHeight = = 4 &&!sps_ibc_enabled_flag ) )     cu_skip_flag[ x0 ][ y0 ] ae(v)   if(cu_skip_flag[ x0 ][ y0 ] = = 0 && slice_type != I    && !( cbWidth = = 4&& cbHeight = = 4 ) )     pred_mode_flag ae(v)   if( ( ( slice_type = =I && cu_skip_flag[ x0 ][ y0 ] = =0 ) ∥     ( slice_type != I && (CuPredMode[ x0 ][ y0 ] != MODE_INTRA ∥     ( cbWidth = = 4 && cbHeight == 4 && cu_skip_flag[ x0 ][ y0 ] = = 0 ) ) ) ) &&    sps_ibc_enabled_flag && ( cbWidth != 128  

  cbHeight != 128 ) )     pred_mode_ibc_flag ae(v)  }  ...8.6.2 Derivation Process for Motion Vector Components for IBC Blocks8.6.2.1 General

It is a requirement of bitstream comformance that when the block vectorvalidity checking process in clause 8.6.3.2 is invoked with the blockvector mvL, isBVvalid shall be true

8.6.3 Decoding Process for IBC Blocks

8.6.3.1 General

This process is invoked when decoding a coding unit coded in ibcprediction mode.

Inputs to this process are:

-   a luma location (xCb, yCb) specifying the top-left sample of the    current coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples,-   variables numSbX and numSbY specifying the number of luma coding    subblocks in horizontal and vertical direction,-   the motion vectors mv[xSbIdx][ySbIdx] with xSbIdx=0 . . . numSbX−1,    and ySbIdx=0 numSbY−1,-   a variable cIdx specifying the colour component index of the current    block.-   a (nIbcBufW)×(ctbSize) array ibcBuf

For each coding subblock at subblock index (xSbIdx, ySbIdx) withxSbIdx=0 . . . numSbX−1, and ySbIdx=0 . . . numSbY−1, the followingapplies:

-   The luma location (xSb, ySb) specifying the top-left sample of the    current coding subblock relative to the top-left luma sample of the    current picture is derived as follows:    (xSb,ySb)=(xCb+xSbIdx*sbWidth,yCb+ySbIdx*sbHeight)  (8-913)    If cIdx is equal to 0, nIbcBufW is set to ibcBufferWidth, otherwise    nIbcBufW is set to (ibcBufferWidth/SubWidthC). The following    applies:    predSamples[xSb+x][ySb+y]=ibcBuf[(xSb+x+(mv[xSb][ySb][0]>>4))%nIbcRefW][ySb+y+(mv[xSb][ySb][1]>>4)]

with x=0 . . . sbWidth−1 and y=0 . . . sbHeight−1.

. . .

8.6.3.2 Block Vector Validity Checking Process

-   Inputs to this process are:-   a luma location (xCb, yCb) specifying the top-left sample of the    current coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples,-   variables numSbX and numSbY specifying the number of luma coding    subblocks in horizontal and vertical direction,-   the block vectors mv[xSbIdx][ySbIdx] with xSbIdx=0 . . . numSbX−1,    and ySbIdx=0 . . . numSbY−1,-   a variable cIdx specifying the colour component index of the current    block.-   a (nIbcBufW)×(ctbSize) array ibcBuf    Outputs of this process is a flag isBVvalid to indicate if the block    vector is valid or not. The following applies    -   1. isBVvalid is set equal to true.    -   2. If ((yCb & (ctbSize−1))+mv[0][0][1]+ cbHeight)> ctbSize,        isBVvalid is set equal to false.    -   3. Otherwise, for each subblock index xSbIdx, ySbIdx with        xSbIdx=0 . . . numSbX−1, and ySbIdx=0 . . . numSbY−1, its        position relative to the top-left luma sample of the ibcBuf is        derived:        -   xTL=(xCb+ xSbIdx*sbWidth+mv[xSbIdx][ySbIdx][0])&(nIbcBufW−1)        -   yTL=(yCb&(ctbSize−1))+ ySbIdx*sbHeight+mv[xSbIdx][ySbIdx][1]        -   xBR=(xCb+ xSbIdx*sbWidth+            sbWidth−1+mv[xSbIdx][ySbIdx][0])&(nIbcBufW−1)        -   yBR=(yCb&(ctbSize−1))+ ySbIdx*sbHeight+            sbHeight−1+mv[xSbIdx][ySbIdx][1]            if (isDecoded[xTL>>2][yTL>>2]==0) or            (isDecoded[xBR>>2][yTL>>2]==0) or            (isDecoded[xBR>>2][yBR>>2]==0), isBVvalid is set equal to            false.            8.7.5 Picture Reconstruction Process            8.7.5.1 General

Inputs to this process are:

-   a location (xCurr, yCurr) specifying the top-left sample of the    current block relative to the top-left sample of the current picture    component,-   the variables nCurrSw and nCurrSh specifying the width and height,    respectively, of the current block,-   a variable cIdx specifying the colour component of the current    block,-   an (nCurrSw)×(nCurrSh) array predSamples specifying the predicted    samples of the current block,-   an (nCurrSw)×(nCurrSh) array resSamples specifying the residual    samples of the current block.

Output of this process are

-   a reconstructed picture sample array recSamples.-   an IBC reference array ibcBuf.-   . . .-   Denote nIbcBufW as the width of ibcBuf, the following applies:

ibcBuf[(xCurr+i)&(nIbcBufW−1)][(yCurr)&(ctbSize−1)]=recSamples[xCurr+i][yCurr+j]

with i=0 . . . nCurrSw−1, j=0 . . . nCurrSh−1.

5.16 Embodiment #16

This is identical to the previous embodiment except for the followingchanges

slice_data( ) { Descriptor  for( i = 0; i < NumBricksInCurrSlice; i++ ){   CtbAddrInBs = FirstCtbAddrBs[ SliceBrickIdx[ i ] ]   for( j = 0; j<NumCtusInBrick[ SliceBrickIdx[ i ] ]; j++, CtbAddrInBs++ ) {    if( ( j% BrickWidth[ SliceBrickIdx[ i ]] ) = = 0 ) {     NumHmvpCand = 0    NumHmvpIbcCand = 0

 

 

 

 

 

 

 

 

   }    CtbAddrInRs = CtbAddrBsToRs[ CtbAddrInBs ]    ......

 

 

 

 

 

 

 

 

 

 

BufWidth is equal to (CtbSizeY==128)?192:(128*128/CtbSizeY) andBufHeight is equal to CtbSizeY.

5.17 Embodiment #17

The changes in some examples are indicated in bolded, underlined, textin this document

7.3.7 Slice Data Syntax

7.3.7.1 General Slice Data Syntax

slice_data( ) { Descriptor  for( i = 0; i < NumBricksInCurrSlice; i++ ){   CtbAddrInBs = FirstCtbAddrBs[ SliceBrickIdx[ i ]   for( j = 0; j <NumCtusInBrick[ SliceBrickIdx[ i ]; j++, CtbAddrInBs++ ) {    if( ( j %BrickWidth[ SliceBrickIdx[ i ] ] ) == 0) {     NumHmvpCand = 0    NumHmvpIbcCand = 0    

   }    CtbAddrInRs = CtbAddrBsToRs[ CtbAddrInBs ]    coding_tree_unit()    if( entropy_coding_sync_enabled_flag &&      ( ( j + 1) %BrickWidth[ SliceBrickIdx[ i ] ] = = 0 ) ) {     end_of_subset_one_bit/* equal to 1 */ ae(v)     if( j <NumCtusInBrick[ SliceBrickIdx[ i ] ] −1 )      byte alignment( )    }   }   if(!entropy_coding_sync_enabled_flag ) {    end_of_brick_one_bit /* equalto 1 */ ae(v)    if( i <NumBricksInCurrSlice − 1 )     byte_alignment( )  }  } }7.4.8.5 Coding Unit Semantics

When all the following conditions are true, the history-based motionvector predictor list for the shared merging candidate list region isupdated by setting NumHmvpSmrIbcCand equal to NumHmvpIbcCand, andsetting HmvpSmrIbcCandList[i] equal to HmvpIbcCandList[i] for i=0 . . .NumHmvpIbcCand−1:

-   IsInSmr[x0][y0] is equal to TRUE.-   SmrX[x0][y0] is equal to x0.-   SmrY[x0][y0] is equal to y0.

The following assignments are made for x=x0 . . . x0+ cbWidth−1 and y=y0. . . y0+ cbHeight−1:CbPosX[x][y]=x0  (7-135)CbPosY[x][y]=y0  (7-136)CbWidth[x][y]=cbWidth  (7-137)CbHeight[x][y]=cbHeight(7-138)

-   Set vSize as min(ctbSize, 64) and wIbcBuf as (128*128/ctbSize). The    width and height of ibcBuf is wIbcBuf and ctbSize accordingly.-   If refreshIbcBuf is equal to 1, the following applies    -   ibcBuf[x % wIbcBuf][y % ctbSize]=−1, for x=x0 . . . x0+        wIbcBuf−1 and y=y0 . . . y0+ ctbSize−1    -   resetIbcBuf=0-   When (x0% vSize) is equal to 0 and (y0% vSize) is equal to 0, for    x=x0 . . . x0+ vSize−1 and y=y0 . . . y0+ vSize−1, the following    applies    -   ibcBuf[x % wIbcBuf][y % ctbSize]=−1        8.6.2 Derivation Process for Motion Vector Components for IBC        Blocks        8.6.2.1 General

Inputs to this process are:

-   a luma location (xCb, yCb) of the top-left sample of the current    luma coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples.

Outputs of this process are:

-   the luma motion vector in 1/16 fractional-sample accuracy mvL.

The luma motion vector mvL is derived as follows:

-   The derivation process for IBC luma motion vector prediction as    specified in clause 8.6.2.2 is invoked with the luma location (xCb,    yCb), the variables cbWidth and cbHeight inputs, and the output    being the luma motion vector mvL.-   When general_merge_flag[xCb][yCb] is equal to 0, the following    applies:    -   1. The variable mvd is derived as follows:        mvd[0]=MvdL0[xCb][yCb][0]  (8-883)        mvd[1]=MvdL1[xCb][yCb][1]  (8-884)    -   2. The rounding process for motion vectors as specified in        clause 8.5.2.14 is invoked with mvX set equal to mvL, rightShift        set equal to MvShift+2, and leftShift set equal to MvShift+2 as        inputs and the rounded mvL as output.    -   3. The luma motion vector mvL is modified as follows:        u[0]=(mvL[0]+mvd[0]+2¹⁸)% 2¹⁸  (8-885)        mvL[0]=(u[0]>=2¹⁷)?(u[0]−2¹⁸):u[0]  (8-886)        u[1]=(mvL[1]+mvd[1]+2¹⁸)% 2¹⁸  (8-887)        mvL[1]=(u[1]>=2¹⁷)?(u[1]−2¹⁸):u[1]  (8-888)    -    NOTE 1The resulting values of mvL[0] and mvL[1] as specified        above will always be in the range of −2¹⁷ to 2¹⁷−1, inclusive.

The updating process for the history-based motion vector predictor listas specified in clause 8.6.2.6 is invoked with luma motion vector mvL.

-   It is a requirement of bitstream conformance that the luma block    vector mvL shall obey the following constraints:    -   ((yCb+(mvL[1]>>4))% wIbcBuf)+ cbHeight is less than or equal to        ctbSize    -   For x=xCb . . . xCb+ cbWidth−1 and y=yCb . . . yCb+ cbHeight−1,        ibcBuf[(x+(myL[0]>>4) % wIbcBuf][(y+(mvL[1]>>4)) % ctbSize]shall        not be equal to 1.        8.7.5 Picture Reconstruction Process        8.7.5.1 General

Inputs to this process are:

-   a location (xCurr, yCurr) specifying the top-left sample of the    current block relative to the top-left sample of the current picture    component,-   the variables nCurrSw and nCurrSh specifying the width and height,    respectively, of the current block,-   a variable cIdx specifying the colour component of the current    block,-   an (nCurrSw)×(nCurrSh) array predSamples specifying the predicted    samples of the current block,-   an (nCurrSw)×(nCurrSh) array resSamples specifying the residual    samples of the current block.

Output of this process are a reconstructed picture sample arrayrecSamples and an IBC buffer array ibcBuf

Depending on the value of the colour component cIdx, the followingassignments are made:

-   If cIdx is equal to 0, recSamples corresponds to the reconstructed    picture sample array S_(L) and the function clipCidx1 corresponds to    Clip 1_(Y).-   Otherwise, if cIdx is equal to 1, tuCbfChroma is set equal to    tu_cbf_cb[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cb) and the function clipCidx1 corresponds to    Clip1_(C).-   Otherwise (cIdx is equal to 2), tuCbfChroma is set equal to    tu_cbf_cr[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cr) and the function clipCidx1 corresponds to    Clip1_(C).

Depending on the value of slice_lmcs_enabled_flag, the followingapplies:

-   If slice_lmcs_enabled_flag is equal to 0, the (nCurrSw)×(nCurrSh)    block of the reconstructed samples recSamples at location (xCurr,    yCurr) is derived as follows for i=0 . . . nCurrSw−1, j=0 . . .    nCurrSh−1:    recSamples[xCurr+i][yCurr+j]=clipCidx1(predSamples[i][j]+resSamples[i][j])  (8-992)-   Otherwise (slice_lmcs_enabled_flag is equal to 1), the following    applies:    -   If cIdx is equal to 0, the following applies:        -   The picture reconstruction with mapping process for luma            samples as specified in clause 8.7.5.2 is invoked with the            luma location (xCurr, yCurr), the block width nCurrSw and            height nCurrSh, the predicted luma sample array predSamples,            and the residual luma sample array resSamples as inputs, and            the output is the reconstructed luma sample array            recSamples.    -   Otherwise (cIdx is greater than 0), the picture reconstruction        with luma dependent chroma residual scaling process for chroma        samples as specified in clause 8.7.5.3 is invoked with the        chroma location (xCurr, yCurr), the transform block width        nCurrSw and height nCurrSh, the coded block flag of the current        chroma transform block tuCbfChroma, the predicted chroma sample        array predSamples, and the residual chroma sample array        resSamples as inputs, and the output is the reconstructed chroma        sample array recSamples.-   After decoding the current coding unit, the following applies:

ibcBuf[(xCurr+i) % wIbcBuf][(yCurr+j) % ctbSize]=recSamples[xCurr+i][yCurr+j] for i=0 . . . nCurrSw−1, j=0 . . . nCurrSh−1.

5.18 Embodiment #18

The changes in some examples are indicated in bolded, underlined,italicized text in this document.

7.3.7 Slice Data Syntax

7.3.7.1 General Slice Data Syntax

slice_data( ) { Descriptor  for( i = 0; i < NumBricksInCurrSlice; i++ ){   CtbAddrInBs = FirstCtbAddrBs[ SliceBrickIdx[ i ] ]   for( j = 0; j <NumCtusInBrick[ SliceBrickIdx[ i ] ]; j++ , CtbAddrInBs++ ) {    if( ( j% BrickWidth[ SliceBrickIdx[ i ] ] ) = = 0) {     NumHmvpCand = 0    NumHmvpIbcCand = 0    

   }    CtbAddrInRs = CtbAddrBsToRs[ CtbAddrInBs ]    coding_tree_unit()    if( entropy_coding_sync_enabled_flag &&      ( ( j +1 ) %BrickWidth[ SliceBrickIdx[ i ] ] = = 0 ) ) {     end_of_subset_one_bit/* equal to 1 */ ae(v)     if( j <NumCtusInBrick] SliceBrickIdx[ i ] ]− 1)      byte_alignment( )    }   }   if(!entropy_coding_sync_enabled_flag ) {    end_of_ brick_one_bit /* equalto 1 */ ae(v)    if( i < NumBricksInCurrSlice − 1 )     byte_alignment()   }  } }7.4.8.5 Coding Unit Semantics

When all the following conditions are true, the history-based motionvector predictor list for the shared merging candidate list region isupdated by setting NumHmvpSmrIbcCand equal to NumHmvpIbcCand, andsetting HmvpSmrIbcCandList[i]equal to HmvpIbcCandList[i] for i=0 . . .NumHmvpIbcCand−1:

-   -   IsInSmr[x0][y0] is equal to TRUE.    -   SmrX[x0][y0] is equal to x0.    -   SmrY[x0][y0] is equal to y0.

The following assignments are made for x=x0 . . . x0+ cbWidth−1 and y=y0. . . y0+ cbHeight−1:CbPosX[x][y]=x0  (7-135)CbPosY[x][y]=y0  (7-136)CbWidth[x][y]=cbWidth  (7-137)CbHeight[x][y]=cbHeight  (7-138)

-   Set vSize as min(ctbSize, 64) and wIbcBufY as (128*128/CtbSizeY).-   ibcBuf_(L) is a array with width being wIbcBufY and height being    CtbSizeY.-   ibcBuf_(Cb) and ibcBuf_(Cr) are arrays with width being    wIbcBufC=(wIbcBufY/SubWidthC) and height being    (CtbSizeY/SubHeightC), i.e. CtbSizeC-   If resetIbcBuf is equal to 1, the following applies    -   ibcBuf_(L)[x % wIbcBufY][y % CtbSizeY]=−1, for x=x0 . . . x0+        wIbcBufY−1 and y=y0 . . . y0+ CtbSizeY−1    -   ibcBuf_(Cb)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0 . . . x0+        wIbcBufC−1 and y=y0 . . . y0+ CtbSizeC−1    -   ibcBuf_(Cr)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0 . . . x0+        wIbcBufC−1 and y=y0 . . . y0+ CtbSizeC−1    -   resetIbcBuf=0-   When (x0% vSizeY) is equal to 0 and (y0% vSizeY) is equal to 0, the    following applies    -   ibcBuf_(L)[x % wIbcBufY][y % CtbSizeY]=−1, for x=x0 . . . x0+        vSize−1 and y=y0 . . . y0+ vSize−1    -   ibcBuf_(Cb)[x % wIbcBufC][y % CtbSizeC]=−1, for        x=x0/SubWidthC.x0/SubWidthC+ vSize/SubWidthC−1 and    -   y=y0/SubHeightC . . . y0/SubHeightC+ vSize/SubHeightC−1    -   ibcBuf_(Cr)[x % wIbcBufC][y % CtbSizeC]=1, for x=x0/SubWidthC .        . . x0/SubWidthC+ vSize/SubWidthC−1 and y=y0/SubHeightC . . .        y0/SubHeightC+ vSize/SubHeightC−1        8.6.2 Derivation Process for Motion Vector Components for IBC        Blocks        8.6.2.1 General

Inputs to this process are:

-   a luma location (xCb, yCb) of the top-left sample of the current    luma coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples.

Outputs of this process are:

-   the luma motion vector in 1/16 fractional-sample accuracy mvL.

The luma motion vector mvL is derived as follows:

-   The derivation process for IBC luma motion vector prediction as    specified in clause 8.6.2.2 is invoked with the luma location (xCb,    yCb), the variables cbWidth and cbHeight inputs, and the output    being the luma motion vector mvL.-   When general_merge_flag[xCb][yCb] is equal to 0, the following    applies:    -   1. The variable mvd is derived as follows:        mvd[0]=MvdL0[xCb][yCb][0]  (8-883)        mvd[1]=MvdL0[xCb][yCb][1]  (8-884)    -   2. The rounding process for motion vectors as specified in        clause 8.5.2.14 is invoked with mvX set equal to mvL, rightShift        set equal to MvShift+2, and leftShift set equal to MvShift+2 as        inputs and the rounded mvL as output.    -   3. The luma motion vector mvL is modified as follows:        u[0]=(mvL[0]+mvd[0]+2¹⁸)% 2¹⁸  (8-885)        mvL[0]=(u[0]>=2¹⁷)?(u[0]−2¹⁸):u[0]  (8-886)        u[1]=(mvL[1]+mvd[1]+2¹⁸)% 2¹⁸  (8-887)        mvL[1]=(u[1]>=2¹⁷)?(u[1]−2¹⁸):u[1]  (8-888)    -    NOTE 1—The resulting values of mvL[0] and mvL[1] as specified        above will always be in the range of −2¹⁷ to 2¹⁷−1, inclusive.

The updating process for the history-based motion vector predictor listas specified in clause 8.6.2.6 is invoked with luma motion vector mvL.

Clause 8.6.2.5 is Invoked with mvL as Input and mvC as Output.

It is a requirement of bitstream conformance that the luma block vectormvL shall obey the following constraints:

-   ((yCb+(mvL[1]>>4)) % CtbSizeY)+ cbHeight is less than or equal to    CtbSizeY-   For x=xCb . . . xCb+ cbWidth−1 and y=yCb . . . yCb+ cbHeight−1,    ibcBuf_(L)[(x+(mvL[0]>>4)% wIbcBufY][(y+(mvL[1]>>4)) %    CtbSizeY]shall not be equal to −1.-   If treeType is equal to SINGLE TREE, for x=xCb . . . xCb+ cbWidth−1    and y=yCb . . . yCb+ cbHeight−1, ibcBuf_(Cb)[(x+(mvC[0]>>5)) %    wIbcBufC][(y+(mvC[1>>5)) % CtbSizeC]]shall not be equal to −1.    8.6.3 Decoding Process for ibc Blocks    8.6.3.1 General

This process is invoked when decoding a coding unit coded in ibcprediction mode.

Inputs to this process are:

-   a luma location (xCb, yCb) specifying the top-left sample of the    current coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples,-   colour component index of the current block.-   the motion vector mv,-   an (wIbcBufY)x (CtbSizeY) array ibcBuf_(L), an (wIbcBufC)x(CtbSizeC)    array ibcBuf_(Cb), an (wIbcBufC)x(CtbSizeC) array ibcBuf_(Cr).

Outputs of this process are:

-   an array predSamples of prediction samples.-   For x=xCb . . . xCb+ Width−1 and y=yCb . . . yCb+ Height−1, the    following applies-   If cIdx is qual to 0

predSamples[x][y]=ibcBuf_(L)[(x+mv[0]>>4))% wIbcBufY][(y+(mv[1]>>4))%CtbSizeY]

-   if cIdx is equal to 1

predSamples[x][y]=ibcBuf_(Cb)[: (x+mv[0]>>5))% wIbcBufC][(y+(mv[1]>>5))%CtbSizeC]

-   if cIdx is equal to 2

predSamples[x][y]=ibcBuf_(Cr)[(x+mv[0]>>5))% wIbcBufC][(y+(mv[1]>>5))%CtbSizeC]

8.7.5 Picture Reconstruction Process

8.7.5.1 General

Inputs to this process are:

-   a location (xCurr, yCurr) specifying the top-left sample of the    current block relative to the top-left sample of the current picture    component,-   the variables nCurrSw and nCurrSh specifying the width and height,    respectively, of the current block,-   a variable cIdx specifying the colour component of the current    block,-   an (nCurrSw)x(nCurrSh) array predSamples specifying the predicted    samples of the current block,-   an (nCurrSw)x(nCurrSh) array resSamples specifying the residual    samples of the current block.

Output of this process are a reconstructed picture sample arrayrecSamples andIBC buffer arrays ibcBuf_(L), ibcBuf_(Cb), ibcBuf_(Cr).

Depending on the value of the colour component cIdx, the followingassignments are made:

-   If cIdx is equal to 0, recSamples corresponds to the reconstructed    picture sample array S_(L) and the function clipCidx1 corresponds to    Clip1_(Y).-   Otherwise, if cIdx is equal to 1, tuCbfChroma is set equal to    tu_cbf_cb[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cb) and the function clipCidx1 corresponds to    Clip1_(C).-   Otherwise (cIdx is equal to 2), tuCbfChroma is set equal to    tu_cbf_cr[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cr) and the function clipCidx1 corresponds to    Clip1_(C).

Depending on the value of slice_lmcs_enabled_flag, the followingapplies:

-   If slice_lmcs_enabled_flag is equal to 0, the (nCurrSw)x(nCurrSh)    block of the reconstructed samples recSamples at location (xCurr,    yCurr) is derived as follows for i=0 . . . nCurrSw−1, j=0 . . .    nCurrSh−1:    recSamples[xCurr+i][yCurr+j]=clipCidx1(predSamples[i][j]+resSamples[i][j])  (8-992)-   Otherwise (slice_lmcs_enabled_flag is equal to 1), the following    applies:    -   If cIdx is equal to 0, the following applies:        -   The picture reconstruction with mapping process for luma            samples as specified in clause 8.7.5.2 is invoked with the            luma location (xCurr, yCurr), the block width nCurrSw and            height nCurrSh, the predicted luma sample array predSamples,            and the residual luma sample array resSamples as inputs, and            the output is the reconstructed luma sample array            recSamples.    -   Otherwise (cIdx is greater than 0), the picture reconstruction        with luma dependent chroma residual scaling process for chroma        samples as specified in clause 8.7.5.3 is invoked with the        chroma location (xCurr, yCurr), the transform block width        nCurrSw and height nCurrSh, the coded block flag of the current        chroma transform block tuCbfChroma, the predicted chroma sample        array predSamples, and the residual chroma sample array        resSamples as inputs, and the output is the reconstructed chroma        sample array recSamples.-   After decoding the current coding unit, the following may apply:-   If cIdx is equal to 0, and if treeType is equal to SINGLE TREE or    DUAL TREE LUMA, the following applies-   ibcBuf_(L)[(xCurr+i) % wIbcBufY][(yCurr+j) %    CtbSizeY]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.-   If cIdx is equal to 1, and if treeType is equal to SINGLE TREE or    DUAL TREE CHROMA, the following applies-   ibcBuf_(Cb)[(xCurr+i) % wIbcBufC][(yCurr+j) %    CtbSizeC]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.

If cIdx is equal to 2, and if treeType is equal to SINGLE TREE or DUALTREE CHROMA, the following applies

-   ibcBuf_(Cr)[(xCurr+i) % wIbcBufC][(yCurr+j) %    CtbSizeC]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.

5.19 Embodiment #19

The changes in some examples are indicated in bolded, underlined, textin this document

7.3.7 Slice Data Syntax

7.3.7.1 General Slice Data Syntax

slice_data( ) { Descriptor  for( i = 0; i < NumBricksInCurrSlice; i++ ){   CtbAddrInBs = FirstCtbAddrBs[ SliceBrickIdx[ i ] ]   for( j = 0; j <NumCtusInBrick[ SliceBrickIdx[ i ] ]; j++, CtbAddrInBs++ ) {    if( ( j% BrickWidth[ SliceBrickIdx[ i ] ] ) = = 0) {     NumHmvpCand = 0    NumHmvpIbcCand = 0    

   }    CtbAddrInRs = CtbAddrBsToRs[ CtbAddrInBs ]    coding_tree_unit()    if( entropy_coding_sync_enabled_flag &&      ( ( j + 1 ) %BrickWidth[ SliceBrickIdx[ i ] ] = = 0 ) ) {     end_of_subset_one_bit/* equal to 1 */ ae(v)     if( j < NumCtusInBrick[ SliceBrickIdx[ i ] ]− 1 )      byte_alignment( )    }   }   if(!entropy_coding_sync_enabled_flag ) {    end_of_brick_one_bit /* equalto 1 */ ae(v)    if( i < NumBricksInCurrSlice − 1 )     byte_alignment()   }  } }7.4.8.5 Coding Unit Semantics

When all the following conditions are true, the history-based motionvector predictor list for the shared merging candidate list region isupdated by setting NumHmvpSmrIbcCand equal to NumHmvpIbcCand, andsetting HmvpSmrIbcCandList[i]equal to HmvpIbcCandList[i] for i=0 . . .NumHmvpIbcCand−1:

-   IsInSmr[x0][y0] is equal to TRUE.-   SmrX[x0][y0] is equal to x0.-   SmrY[x0][y0] is equal to y0.

The following assignments are made for x=x0 . . . x0+ cbWidth−1 and y=y0. . . y0+ cbHeight−1:CbPosX[x][y]=x0  (7-135)CbPosY[x][y]=y0  (7-136)CbWidth[x][y]=cbWidth  (7-137)CbHeight[x][y]=cbHeight  (7-138)

-   Set vSize as min(ctbSize, 64) and wIbcBufY as (128*128/CtbSizeY).-   ibcBuf_(L) is a array with width being wIbcBufY and height being    CtbSizeY.-   ibcBuf_(Cb) and ibcBuf_(Cr) are arrays with width being    wIbcBufC=(wIbcBufY/SubWidthC) and height being    (CtbSizeY/SubHeightC), i.e. CtbSizeC-   If resetIbcBuf is equal to 1, the following applies    -   ibcBuf_(L)[x % wIbcBufY][y % CtbSizeY]=−1, for x=x0 . . . x0+        wIbcBufY−1 and y=y0 . . . y0+ CtbSizeY−1    -   ibcBuf_(Cb)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0 . . . x0+        wIbcBufC−1 and y=y0 . . . y0+ CtbSizeC−1    -   ibcBuf_(Cr)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0 . . . x0+        wIbcBufC−1 and y=y0 . . . y0+ CtbSizeC−1    -   resetIbcBuf=0-   When (x0% vSizeY) is equal to 0 and (y0% vSizeY) is equal to 0, the    following applies    -   ibcBuf_(L)[x % wIbcBufY][% CtbSizeY]=−1, for x=x0 . . . x0+        min(vSize, cbWidth)−1 and y=y0 . . . y0+ min(vSize, cbHeight)−1    -   ibcBuf_(Cb)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0/SubWidthC .        . . x0/SubWidthC+ min(vSize/SubWidthC, cbWidth)−1 and        y=y0/SubHeightC . . . y0/SubHeightC+ min(vSize/SubHeightC,        cbHeight)−1    -   ibcBuf_(Cr)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0/SubWidthC .        . . x0/SubWidthC+ min(vSize/SubWidthC, cbWidth)−1 and        y=y0/SubHeightC . . . y0/SubHeightC+ min(vSize/SubHeightC,        cbHeight)−1        8.6.2 Derivation Process for Motion Vector Components for IBC        Blocks        8.6.2.1 General

Inputs to this process are:

-   a luma location (xCb, yCb) of the top-left sample of the current    luma coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples.

Outputs of this process are:

-   the luma motion vector in 1/16 fractional-sample accuracy mvL.

The luma motion vector mvL is derived as follows:

-   The derivation process for IBC luma motion vector prediction as    specified in clause 8.6.2.2 is invoked with the luma location (xCb,    yCb), the variables cbWidth and cbHeight inputs, and the output    being the luma motion vector mvL.-   When general_merge_flag[xCb][yCb] is equal to 0, the following    applies:    -   1. The variable mvd is derived as follows:        mvd[0]=MvdL0[xCb][yCb][0]  (8-883)        mvd[1]=MvdL0[xCb][yCb][1]  (8-884)    -   2. The rounding process for motion vectors as specified in        clause 8.5.2.14 is invoked with mvX set equal to mvL, rightShift        set equal to MvShift+2, and leftShift set equal to MvShift+2 as        inputs and the rounded mvL as output.    -   3. The luma motion vector mvL is modified as follows:        u[0]=(mvL[0]+mvd[0]+2¹⁸)% 2¹⁸  (8-885)        mvL[0]=(u[0]>=2¹⁷)?(u[0]−2¹⁸):u[0]  (8-886)        u[1]=(mvL[1]+mvd[1]+2¹⁸)% 2¹⁸  (8-887)        mvL[1]=(u[1]>=2¹⁷)?(u[1]−2¹⁸):u[1]  (8-888)    -    NOTE 1The resulting values of mvL[0] and mvL[1] as specified        above will always be in the range of −2¹⁷ to 2¹⁷−1, inclusive.

The updating process for the history-based motion vector predictor listas specified in clause 8.6.2.6 is invoked with luma motion vector mvL.

-   Clause 8.6.2.5 is invoked with mvL as input and mvC as output.-   It is a requirement of bitstream conformance that the luma block    vector mvL shall obey the following constraints:    -   ((yCb+(mvL[1]>>4))% CtbSizeY)+ cbHeight is less than or equal to        CtbSizeY    -   For x=xCb . . . xCb+ cbWidth−1 and y=yCb . . . yCb+ cbHeight−1,        ibcBuf_(L)[(x+(mvL[0]>>4))% wIbcBufY][(y+(mvL[1]>>4))%        CtbSizeY]shall not be equal to 1.    -   If treeType is equal to SINGLE TREE, for x=xCb . . . xCb+        cbWidth−1 and y=yCb . . . yCb+ cbHeight−1,        ibcBuf_(Cb)[(x+(mvC[0]>>5))% wIbcBufC][(y+(mvC[1]>>5) %        CtbSizeC]]shall not be equal to −1.        8.6.3 Decoding Process for ibc Blocks        8.6.3.1 General

This process is invoked when decoding a coding unit coded in ibcprediction mode.

Inputs to this process are:

-   a luma location (xCb, yCb) specifying the top-left sample of the    current coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples,-   a variable cIdx specifying the colour component index of the current    block.-   the motion vector mv,-   an (wIbcBufY)x(CtbSizeY) array ibcBuf_(L), an (wIbcBufC)x(CtbSizeC)    array ibcBuf_(Cb), an (wIbcBufC)x(CtbSizeC) array ibcBuf_(Cr).-   Outputs of this process are:    -   an array predSamples of prediction samples.-   For x=xCb . . . xCb+ Width−1 and y=yCb . . . yCb+ Height−1, the    following applies-   If cIdx is qual to 0    -   predSamples[x][y]=ibcBuf_(L)[(x+[0]>>4))%        wIbcBufY][(y+(mv[1]>>4))% CtbSizeY]-   if cIdx is equal to 1    -   predSamples[x][y]=ibcBuf_(Cb)[(x+mv[0]>>5))%        wIbcBufC][(y+(mv[1]>>5)) % CtbSizeC]-   if cIdx is equal to 2    -   predSamples[x][y]=ibcBuf_(Cf)[(x+mv[0]>>5))%        wIbcBufC][(y+(mv[1]>>5)) % CtbSizeC]        8.7.5 Picture Reconstruction Process        8.7.5.1 General

Inputs to this process are:

-   a location (xCurr, yCurr) specifying the top-left sample of the    current block relative to the top-left sample of the current picture    component,-   the variables nCurrSw and nCurrSh specifying the width and height,    respectively, of the current block,-   a variable cIdx specifying the colour component of the current    block,-   an (nCurrSw)x(nCurrSh) array predSamples specifying the predicted    samples of the current block,-   an (nCurrSw)x(nCurrSh) array resSamples specifying the residual    samples of the current block.

Output of this process are a reconstructed picture sample arrayrecSamples and IBC buffer arrays ibcBuf_(L), ibcBuf_(Cb), ibcBuf_(Cr).

Depending on the value of the colour component cIdx, the followingassignments are made:

-   If cIdx is equal to 0, recSamples corresponds to the reconstructed    picture sample array S_(L) and the function clipCidx1 corresponds to    Clip1_(Y).-   Otherwise, if cIdx is equal to 1, tuCbfChroma is set equal to    tu_cbf_cb[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cb) and the function clipCidx1 corresponds to    Clip1_(C).-   Otherwise (cIdx is equal to 2), tuCbfChroma is set equal to    tu_cbf_cr[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cr) and the function clipCidx1 corresponds to    Clip1_(C).

Depending on the value of slice_lmcs_enabled_flag, the followingapplies:

-   If slice_lmcs_enabled_flag is equal to 0, the (nCurrSw)x(nCurrSh)    block of the reconstructed samples recSamples at location (xCurr,    yCurr) is derived as follows for i=0 . . . nCurrSw−1, j=0 . . .    nCurrSh−1:    recSamples[xCurr+i][yCurr+j]=clipCidx1(predSamples[i][j]+resSamples[i][j])  (8-992)-   Otherwise (slice_lmcs_enabled_flag is equal to 1), the following    applies:    -   If cIdx is equal to 0, the following applies:        -   The picture reconstruction with mapping process for luma            samples as specified in clause 8.7.5.2 is invoked with the            luma location (xCurr, yCurr), the block width nCurrSw and            height nCurrSh, the predicted luma sample array predSamples,            and the residual luma sample array resSamples as inputs, and            the output is the reconstructed luma sample array            recSamples.    -   Otherwise (cIdx is greater than 0), the picture reconstruction        with luma dependent chroma residual scaling process for chroma        samples as specified in clause 8.7.5.3 is invoked with the        chroma location (xCurr, yCurr), the transform block width        nCurrSw and height nCurrSh, the coded block flag of the current        chroma transform block tuCbfChroma, the predicted chroma sample        array predSamples, and the residual chroma sample array        resSamples as inputs, and the output is the reconstructed chroma        sample array recSamples.-   After decoding the current coding unit, the following may apply:-   If cIdx is equal to 0, and if treeType is equal to SINGLE TREE or    DUAL TREE LUMA, the following applies-   ibcBuf_(L)[(xCurr+i) % wIbcBufY][(yCurr+j) %    CtbSizeY]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.-   If cIdx is equal to 1, and if treeType is equal to SINGLE TREE or    DUAL TREE CHROMA, the following applies-   ibcBuf_(Cb)[(xCurr+i) % wIbcBufC][(yCurr+j) %    CtbSizeC]=recSamples[xCurr+i][yCurr+j]for i=0 . . . nCurrSw−1, j=0 .    . . nCurrSh−1.-   If cIdx is equal to 2, and if treeType is equal to SINGLE TREE or    DUAL TREE CHROMA, the following applies-   ibcBuf_(Cr)[(xCurr+i) % wIbcBufC][(yCurr+j) %    CtbSizeC]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.

5.20 Embodiment #20

The changes in some examples are indicated in bolded, underlined,italicized text in this document.

7.3.7 Slice Data Syntax

7.3.7.1 General Slice Data Syntax

slice data( ) { Descriptor  for( i = 0; i < NumBricksInCurrSlice; i++ ){   CtbAddrInBs = FirstCtbAddrBs[ SliceBrickIdx[ i ] ]   for( j = 0; j <NumCtusInBrick[ SliceBrickIdx[ i ] ]; j++, CtbAddrInBs++ ) {    if( ( j% BrickWidth[ SliceBrickIdx[ i ] ]) = = 0) {     NumHmvpCand = 0    NumHmvpIbcCand = 0    

   }    CtbAddrInRs = CtbAddrBsToRs[ CtbAddrInBs ]    coding_tree_unit()    if( entropy_coding_sync_enabled_flag &&      ( ( j + 1) %BrickWidth[ SliceBrickIdx[ i ] ] = = 0 ) ) {     end_of_subset_one_bit/* equal to 1 */ ae(v)     if( j < NumCtusInBrick[ SliceBrickIdx[ i ] ]− 1)      byte alignment( )    }   }   if(!entropy_coding_sync_enabled_flag ) {    end_of_brick_one_bit /* equalto 1 */ ae(v)    if( i < NumBricksInCurrSlice − 1)     byte_alignment( )  }  } }7.4.8.5 Coding Unit Semantics

When all the following conditions are true, the history-based motionvector predictor list for the shared merging candidate list region isupdated by setting NumHmvpSmrIbcCand equal to NumHmvpIbcCand, andsetting HmvpSmrIbcCandList[i]equal to HmvpIbcCandList[i] for i=0 . . .NumHmvpIbcCand−1:

-   IsInSmr[x0][y0] is equal to TRUE.-   SmrX[x0][y0] is equal to x0.-   SmrY[x0][y0] is equal to y0.

The following assignments are made for x=x0 . . . x0+ cbWidth−1 and y=y0. . . y0+ cbHeight−1:CbPosX[x][y]=x0  (7-135)CbPosY[x][y]=y0  (7-136)CbWidth[x][y]=cbWidth  (7-137)CbHeight[x][y]=cbHeight  (7-138)

-   Set vSize as min(ctbSize, 64) and wIbcBufY as (128*128/CtbSizeY).-   ibcBuf_(L) is a array with width being wIbcBufY and height being    CtbSizeY.-   ibcBuf_(Cb) and ibcBuf_(Cr) are arrays with width being    wIbcBufC=(wIbcBufY/SubWidthC) and height being    (CtbSizeY/SubHeightC), i.e. CtbSizeC-   If resetIbcBuf is equal to 1, the following applies    -   ibcBuf_(L)[x % wIbcBufY][y % CtbSizeY]=−1, for x=x0 . . . x0+        wIbcBufY−1 and y=y0 . . . y0+ CtbSizeY−1    -   ibcBuf_(Cb)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0 . . . x0+        wIbcBufC−1 and y=y0 . . . y0+ CtbSizeC−1    -   ibcBuf_(Cr)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0 . . . x0+        wIbcBufC−1 and y=y0 . . . y0+ CtbSizeC−1    -   resetIbcBuf=0-   When (x0% vSizeY) is equal to 0 and (y0% vSizeY) is equal to 0, the    following applies    -   ibcBuf_(L)[x % wIbcBufY][y % CtbSizeY]=−1, for x=x0 . . . x0+        max(vSize, cbWidth)−1 and y=y0 . . . y0+ max(vSize, cbHeight)−1    -   ibcBuf_(Cb)[x % wIbcBufC][y % CtbSizeC]=−1, for x=x0/SubWidthC .        . . x0/SubWidthC+ max(vSize/SubWidthC, cbWidth)−1 and        y=y0/SubHeightC . . . y0/SubHeightC+ max(vSize/SubHeightC,        cbHeight)−1    -   ibcBuf_(Cr)[x % wIbcBufC][y % CtbSizeC]=−1, for        x=x0/SubWidthC.x0/SubWidthC+ max(vSize/SubWidthC, cbWidth)−1 and        y=y0/SubHeightC . . . y0/SubHeightC+ max(vSize/SubHeightC,        cbHeight)−1        8.6.2 Derivation Process for Motion Vector Components for IBC        Blocks        8.6.2.1 General

Inputs to this process are:

-   a luma location (xCb, yCb) of the top-left sample of the current    luma coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples.

Outputs of this process are:

-   the luma motion vector in 1/16 fractional-sample accuracy mvL.

The luma motion vector mvL is derived as follows:

-   The derivation process for IBC luma motion vector prediction as    specified in clause 8.6.2.2 is invoked with the luma location (xCb,    yCb), the variables cbWidth and cbHeight inputs, and the output    being the luma motion vector mvL.-   When general_merge_flag[xCb][yCb] is equal to 0, the following    applies:    -   1. The variable mvd is derived as follows:        mvd[0]=MvdL0[xCb][yCb][0]  (8-883)        mvd[1]=MvdL0[xCb][yCb][1]  (8-884)    -   2. The rounding process for motion vectors as specified in        clause 8.5.2.14 is invoked with mvX set equal to mvL, rightShift        set equal to MvShift+2, and leftShift set equal to MvShift+2 as        inputs and the rounded mvL as output.    -   3. The luma motion vector mvL is modified as follows:        u[0]=(mvL[0]+mvd[0]+2¹⁸)&2¹⁸  (8-885)        mvL[0]=(u[0]>=2¹⁷)?(u[0]−2¹⁸):u[0]  (8-886)        u[1]=(mvL[1]+mvd[1]+2¹⁸)%2¹⁸  (8-887)        mvL[1]=(u[1]>=2¹⁷)?(u[1]−2¹⁸):u[1]  (8-888)    -   NOTE 1—The resulting values of mvL[0] and mvL[1] as specified        above will always be in the range of −2¹⁷ to 2¹⁷−1, inclusive.

The updating process for the history-based motion vector predictor listas specified in clause 8.6.2.6 is invoked with luma motion vector mvL.

-   Clause 8.6.2.5 is invoked with mvL as input and mvC as output.-   It is a requirement of bitstream conformance that the luma block    vector mvL shall obey the following constraints:-   ((yCb+(mvL[1]>>4)) % CtbSizeY)+ cbHeight is less than or equal to    CtbSizeY-   For x=xCb . . . xCb+ cbWidth−1 and y=yCb . . . yCb+ cbHeight−1,    ibcBuf_(L)[(x+(mvL[0]>>4))% wIbcBufY][(y+(mvL[1]>>4)) %    CtbSizeY]shall not be equal to −1.    8.6.3 Decoding Process for ibc Blocks    8.6.3.1 General

This process is invoked when decoding a coding unit coded in ibcprediction mode.

Inputs to this process are:

-   a luma location (xCb, yCb) specifying the top-left sample of the    current coding block relative to the top-left luma sample of the    current picture,-   a variable cbWidth specifying the width of the current coding block    in luma samples,-   a variable cbHeight specifying the height of the current coding    block in luma samples,-   a variable cIdx specifying the colour component index of the current    block.-   the motion vector mv,-   an (wIbcBufY)x(CtbSizeY) array ibcBuf_(L), an (wIbcBufC)x(CtbSizeC)    array ibcBuf_(Cb), an (wIbcBufC)x(CtbSizeC) array ibcBuf_(Cr).    Outputs of this process are:-   an array predSamples of prediction samples.-   For x=xCb . . . xCb+ Width−1 and y=yCb . . . yCb+ Height−1, the    following applies-   If cIdx is qual to 0    -   predSamples[x][y]=ibcBuf_(L)[(x+mv[0]>>4))%        wIbcBufY][(y+(mv[1]>>4))% CtbSizeY] if cIdx is equal to 1    -   predSamples[x][y]=ibcBuf_(Cb)[(x+mv[0]>>5))%        wIbcBufC][(y+(mv[1]>>5))% CtbSizeC]-   if cIdx is equal to 2    -   predSamples[x][y]=ibcBuf_(Cr)[(x+mv[0]>>5))%        wIbcBufC][(y+(mv[1]>>5))% CtbSizeC]        8.7.5 Picture Reconstruction Process        8.7.5.1 General

Inputs to this process are:

-   a location (xCurr, yCurr) specifying the top-left sample of the    current block relative to the top-left sample of the current picture    component,-   the variables nCurrSw and nCurrSh specifying the width and height,    respectively, of the current block,-   a variable cIdx specifying the colour component of the current    block,-   an (nCurrSw)x(nCurrSh) array predSamples specifying the predicted    samples of the current block,-   an (nCurrSw)x(nCurrSh) array resSamples specifying the residual    samples of the current block.

Output of this process are a reconstructed picture sample arrayrecSamples and IBC buffer arrays ibcBuf_(L), ibcBuf_(Cb), ibcBuf_(Cr).

Depending on the value of the colour component cIdx, the followingassignments are made:

-   If cIdx is equal to 0, recSamples corresponds to the reconstructed    picture sample array S_(L) and the function clipCidx1 corresponds to    Clip1_(Y).-   Otherwise, if cIdx is equal to 1, tuCbfChroma is set equal to    tu_cbf_cb[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cb) and the function clipCidx1 corresponds to    Clip1_(C).-   Otherwise (cIdx is equal to 2), tuCbfChroma is set equal to    tu_cbf_cr[xCurr][yCurr], recSamples corresponds to the reconstructed    chroma sample array S_(Cr) and the function clipCidx1 corresponds to    Clip1_(C).

Depending on the value of slice_lmcs_enabled_flag, the followingapplies:

-   If slice_lmcs_enabled_flag is equal to 0, the (nCurrSw)x(nCurrSh)    block of the reconstructed samples recSamples at location (xCurr,    yCurr) is derived as follows for i=0 . . . nCurrSw−1, j=0 . . .    nCurrSh−1:    recSamples[xCurr+i][yCurr+j]=clipCidx1(predSamples[i][j]+resSamples[i][j])  (8-992)-   Otherwise (slice_lmcs_enabled_flag is equal to 1), the following    applies:    -   If cIdx is equal to 0, the following applies:        -   The picture reconstruction with mapping process for luma            samples as specified in clause 8.7.5.2 is invoked with the            luma location (xCurr, yCurr), the block width nCurrSw and            height nCurrSh, the predicted luma sample array predSamples,            and the residual luma sample array resSamples as inputs, and            the output is the reconstructed luma sample array            recSamples.    -   Otherwise (cIdx is greater than 0), the picture reconstruction        with luma dependent chroma residual scaling process for chroma        samples as specified in clause 8.7.5.3 is invoked with the        chroma location (xCurr, yCurr), the transform block width        nCurrSw and height nCurrSh, the coded block flag of the current        chroma transform block tuCbfChroma, the predicted chroma sample        array predSamples, and the residual chroma sample array        resSamples as inputs, and the output is the reconstructed chroma        sample array recSamples.-   After decoding the current coding unit, the following may apply:-   If cIdx is equal to 0, and if treeType is equal to SINGLE TREE or    DUAL TREE LUMA, the following applies-   ibcBuf_(L)[(xCurr+i) % wIbcBufY][(yCurr+j) %    CtbSizeY]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.-   If cIdx is equal to 1, and if treeType is equal to SINGLE TREE or    DUAL TREE CHROMA, the following applies-   ibcBuf_(Cb)[(xCurr+i) % wIbcBufC][(yCurr+j) %    CtbSizeC]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.-   If cIdx is equal to 2, and if treeType is equal to SINGLE TREE or    DUAL TREE CHROMA, the following applies-   ibcBuf_(Cr)[(xCurr+i) % wIbcBufC][(yCurr+j) %    CtbSizeC]=recSamples[xCurr+i] [yCurr+j] for i=0 . . . nCurrSw−1, j=0    . . . nCurrSh−1.

FIG. 6 is a flowchart of an example method 600 of visual media (video orimage) processing. The method 600 includes determining (602), for aconversion between a current video block and a bitstream representationof the current video block, a size of a buffer to store referencesamples for the current video block using an intra-block copy codingmode, and performing (604) the conversion using the reference samplesstored in the buffer.

The following clauses describe some example preferred featuresimplemented by embodiments of method 600 and other methods. Additionalexamples are provided in Section 4 of the present document.

1. A method of video processing, comprising: determining, for aconversion between a current video block and a bitstream representationof the current video block, a size of a buffer to store referencesamples for the current video block using an intra-block copy codingmode; and performing the conversion using the reference samples storedin the buffer.

2. The method of clause 1, wherein the size of the buffer is apredetermined constant.

3. The method of any of clauses 1-2, wherein the size is M×N, where Mand N are integers.

4. The method of clause 3, wherein M×N is equal to 64×64 or 128×128 or64×128.

5. The method of clause 1, wherein the size of the buffer is equal to asize of a coding tree unit of the current video block.

6. The method of clause 1, wherein the size of the buffer is equal to asize of a virtual pipeline data unit used during the conversion.

7. The method of clause 1, wherein the size of the buffer corresponds afield in the bitstream representation.

8. The method of clause 7, wherein the field is included in thebitstream representation at a video parameter set or sequence parameterset or picture parameter set or a picture header or a slice header or atile group header level.

9. The method of any of clauses 1-8, wherein the size of the buffer isdifferent for reference samples for luma component and reference samplesfor chroma components.

10. The method of any of clauses 1-8, wherein the size of the buffer isdependent on chroma subsampling format of the current video block.

11. The method of any of clauses 1-8, wherein the reference samples arestored in RGB format.

12. The method of any of clauses 1-11, wherein the buffer is used forstoring reconstructed samples before loop filtering and after loopfiltering.

13. The method of clause 12, wherein loop filtering includes deblockingfiltering or adaptive loop filtering (ALF) or sample adaptive offset(SAO) filtering.

14. A method of video processing, comprising: initializing, for aconversion between a current video block and a bitstream representationof the current video block, a buffer to store reference samples for thecurrent video block using an intra-block copy coding mode using initialvalues for the reference samples; and performing the conversion usingthe reference samples stored in the buffer.

15. The method of clause 14, wherein the initial values correspond to aconstant.

16. The method of any of clauses 14-15, wherein the initial values are afunction of bit-depth of the current video block.

17. The method of clause 15, wherein the constant corresponds to amid-grey value.

18. The method of clause 14, wherein the initial values correspond topixel values of a previously decoded video block.

19. The method of clause 18, wherein the previously decoded video blockcorresponds to a decoded block prior to in-loop filtering.

20. The method of any of clauses 14-19, wherein a size of the buffer isat recited in one of clauses 1-13.

21. The method of any of clauses 1-20, wherein pixel locations withinthe buffer as addressed using x and y numbers.

22. The method of any of clauses 1-20, wherein pixel locations withinthe buffer as addressed using a single number that extends from 0 toM*N−1, where M and N are pixel width and pixel height of the buffer.

23. The method of any of clauses 1-20, wherein, the current bitstreamrepresentation includes a block vector for the conversion, wherein theblock vector, denoted as (BVx,BVy) is equal to (x-x0,y-y0), where (x0,y0) correspond to an upper-left position of a coding tree unit of thecurrent video block.

24. The method of any of clauses 1-20, wherein, the current bitstreamrepresentation includes a block vector for the conversion, wherein theblock vector, denoted as (BVx,BVy) is equal to (x-x0+Tx,y-y0+Ty), where(x0, y0) correspond to an upper-left position of a coding tree unit ofthe current video block and wherein Tx and Ty are offset values.

25. The method of clause 24, wherein Tx and Ty are pre-defined offsetvalues.

26. The method of any of clauses 1-20, wherein during the conversion,for a pixel at location (x0, y0) and having a block vector (BVx, BVy), acorresponding reference in the buffer is found at a reference location(x0+ BVx, y0+ BVy).

27. The method of clause 26, wherein in case that the reference locationis outside the buffer, the reference in the buffer is determined byclipping at a boundary of the buffer.

28. The method of clause 26, wherein in case that the reference locationis outside the buffer, the reference in the buffer is determined to havea predetermined value.

29. The method of any of clauses 1-20, wherein during the conversion,for a pixel at location (x0, y0) and having a block vector (BVx, BVy), acorresponding reference in the buffer is found at a reference location((x0+ BVx) mod M, (y0+ BVy) mod N) where “mod” is modulo operation and Mand N are integers representing x and y dimensions of the buffer.

30. A method of video processing, comprising: resetting, during aconversion between a video and a bitstream representation of the currentvideo block, a buffer that stores reference samples for intra block copycoding at a video boundary; and performing the conversion using thereference samples stored in the buffer.

31. The method of clause 30, wherein the video boundary corresponds to anew picture or a new tile.

32. The method of clause 30, wherein the conversion is performed byupdating, after the resetting, the buffer with reconstructed values of aVirtual Pipeline Data Unit (VPDU).

33. The method of clause 30, wherein the conversion is performed byupdating, after the resetting, the buffer with reconstructed values of acoding tree unit.

34. The method of clause 30, wherein the resetting is performed atbeginning of each coding tree unit row.

35. The method of clause 1, wherein the size of the buffer correspondstoL64×64 previously decoded blocks., where L is an integer.

36. The method of any of clauses 1-35, wherein a vertical scan order isused for reading or storing samples in the buffer during the conversion.

37. A method of video processing, comprising: using, for a conversionbetween a current video block and a bitstream representation of thecurrent video block, a buffer to store reference samples for the currentvideo block using an intra-block copy coding mode, wherein a firstbit-depth of the buffer is different than a second bit-depth of thecoded data; and performing the conversion using the reference samplesstored in the buffer.

38. The method of clause 37, wherein the first bit-depth is greater thanthe second bit-depth.

39. The method of any of clauses 37-38, wherein the first bit-depth isidentical to a bit-depth of a reconstruction buffer used during theconversion.

40. The method of any of clauses 37-39, wherein the first bit-depth issignaled in the bitstream representation as a value or a differencevalue.

41. The method of any of clauses 37-40, wherein the conversion usesdifferent bit-depths for chroma and luma components.

Additional embodiments and examples of clauses 37 to 41 are described inItem 7 in Section 4.

42. A method of video processing, comprising: performing a conversionbetween a current video block and a bitstream representation of thecurrent video block using an intra-block cow mode in which a firstprecision used for prediction calculations during the conversion islower than a second precision used for reconstruction calculationsduring the conversion.

43. The method of clause 43, wherein the prediction calculations includedetermining a prediction sample value from a reconstructed sample valueusing clip {{p+[1<<(b−1)]}>> b,0,(1<<bitdepth)−1}<<b, where p is thereconstructed sample value, b is a predefined bit-shifting value, andbitdepth is a prediction sample precision.

Additional embodiments and examples of clauses 42 to 43 are described inItem 28 to 31 and 34 in Section 4.

44. A method of video processing, comprising: performing a conversionbetween a current video block and a bitstream representation of thecurrent video block using an intra-block cow mode in which a referencearea of size nM×nM is used for a coding tree unit size M×M, where n andM are integers and wherein the current video block is positioned in thecoding tree unit, and wherein the reference area is a nearest availablen×n coding tree unit in a coding tree unit row corresponding to thecurrent video block.

Additional embodiments and examples of clause 4 are described in Item 35in Section 4.

45. A method of video processing, comprising: performing a conversionbetween a current video block and a bitstream representation of thecurrent video block using an intra-block cow mode in which a referencearea of size nM×nM is used for a coding tree unit size other than M×M,where n and M are integers and wherein the current video block ispositioned in the coding tree unit, and wherein the reference area is anearest available n×n−1 coding tree unit in a coding tree unit rowcorresponding to the current video block.

Additional embodiments and examples of clause 4 are described in Item 36in Section 4. FIGS. 8 and 9 show additional example embodiments.

46. The method of claim 3, wherein M=mW and N=H, where W and H are widthand height of a coding tree unit (CTU) of the current video block, and mis a positive integer.

47. The method of claim 3, wherein M=W and N=nH, where W and H are widthand height of a coding tree unit (CTU), and n is a positive integer.

48. The method of claim 3, wherein M=mW and N=nH, where W and H arewidth and height of a coding tree unit (CTU), m and n are positiveintegers.

49. The method of any of clause 46-48, wherein n and m depend on a sizeof the CTU.

50. A method of video processing, comprising: determining, for aconversion between a current video block of a video and a bitstreamrepresentation of the current video block, validity of a block vectorcorresponding to the current video block of a component c of the videousing a component X of the video, wherein the component X is differentfrom a luma component of the video; and performing the conversion usingthe block vector upon determining that the block vector is valid for thecurrent video block. Here, the block vector, denoted as (BVx,BVy) isequal to (x-x0,y-y0), where (x0, y0) correspond to an upper-leftposition of a coding tree unit of the current video block.

51. The method of clause 50, wherein the component c corresponds to theluma component of the video.

52. The method of clause 50, wherein the current video block is a chromablock and the video is in a 4:4:4 format.

53. The method of clause 50, wherein the video is in a 4:2:0 format, andwherein the current video block is a chroma block starting at position(x, y), and wherein the determining comprises determining the blockvector to be invalid for a case in which isRec(c, ((x+BVx)>>5<<5)+64−(((y+ BVy)>>5)&1)*32+(x %32), ((y+ BVy)>>5<<5)+(y %32))is true.

54. The method of clause 50, wherein the video is in a 4:2:0 format, andwherein the current video block is a chroma block starting at position(x, y), and wherein the determining comprises determining the blockvector to be invalid for a case in which if isRec(c, x+ BVx+Chroma_CTU_size, y) is true.

55. A method of video processing, comprising: determining, selectivelyfor a conversion between a current video block of a current virtualpipeline data unit (VPDU) of a video region and a bitstreamrepresentation of the current video block, to use K1 previouslyprocessed VPDUs from a first row of the video region and K2 previouslyprocessed VPDUs from a second row of the video region; and performingthe conversion, wherein the conversion excludes using remaining of thecurrent VPDU.

56. The method of clause 55, wherein K1=1 and K2=2.

57. The method of any of clauses 55-56, wherein the current video blockis selectively processed based on a dimension of the video region or adimension of the current VPDU.

58. A method of video processing, comprising: performing a validitycheck of a block vector for a conversion between a current video blockand a bitstream representation of the current video block, wherein theblock vector is used for intra block copy mode; and using a result ofthe validity check to selectively use the block vector during theconversion.

59. The method of clause 58, wherein an intra block copy (IBC) buffer isused during the conversion, wherein a width and a height of the IBCbuffer as Wbuf and Hbuf an dimensions of the current video block are W×Hand wherein the block vector is represented as (BVx, BVy), and whereinthe current video block is in a current picture having dimensions Wpicand Hpic and a coding tree unit having Wctu and Hctu as width andheight, and wherein the validity check uses a pre-determined rule.

60. The method of any of clauses 58-59, wherein the current video blockis a luma block, a chroma block, a coding unit CU, a transform unit TU,a 4×4 block, a 2×2 block, or a subblock of a parent block starting frompixel coordinates (X, Y).

61. The method of any of clauses 58-60, wherein the validity checkconsiders the block vector that falls outside a boundary of the currentpicture as valid.

62. The method of any of clauses 58-60, wherein the validity checkconsiders the block vector that falls outside a boundary of the codingtree unit as valid.

Items 23-30 in the previous section provide additional examples andvariations of the above clauses 58-62.

63. The method of any of clauses 1-62, wherein the conversion includesgenerating the bitstream representation from the current video block.

64. The method of any of clauses 1-62, wherein the conversion includesgenerating pixel values of the current video block from the bitstreamrepresentation.

65. A video encoder apparatus comprising a processor configured toimplement a method recited in any one or more of clauses 1-62.

66. A video decoder apparatus comprising a processor configured toimplement a method recited in any one or more of clauses 1-62.

67. A computer readable medium having code stored thereon, the codeembodying processor-executable instructions for implementing a methodrecited in any of or more of clauses 1-62.

FIG. 7 is a block diagram of a hardware platform of a video/imageprocessing apparatus 700. The apparatus 700 may be used to implement oneor more of the methods described herein. The apparatus 700 may beembodied in a smartphone, tablet, computer, Internet of Things (IoT)receiver, and so on. The apparatus 700 may include one or moreprocessors 702, one or more memories 704 and video processing hardware706. The processor(s) 702 may be configured to implement one or moremethods (including, but not limited to, method 600) described in thepresent document. The memory (memories) 704 may be used for storing dataand code used for implementing the methods and techniques describedherein. The video processing hardware 706 may be used to implement, inhardware circuitry, some techniques described in the present document.

The bitstream representation corresponding to a current video block neednot be a contiguous set of bits and may be distributed across headers,parameter sets, and network abstraction layer (NAL) packets.

Section A: Another Additional Example Embodiment

In Section A, we present another example embodiment in which the currentversion of the VVC standard may be modified for implementing some of thetechniques described in the present document.

This section analyzes several issues in the current IBC reference bufferdesign and presents a different design to address the issues. Anindependent IBC reference buffer is proposed instead of mixing withdecoding memory. Compared with the current anchor, the proposed schemeshows −0.99%/−0.71%/−0.79% AI/RA/LD-B luma BD-rate for class F and−2.57%/−1.81%/−1.36% for 4:2:0 TGM, with 6.7% memory reduction; or−1.31%/−1.01%/−0.81% for class F and −3.23%/−2.33%/−1.71% for 4:2:0 TGMwith 6.7% memory increase.

A1. Introduction

Intra block copy, i.e. IBC (or current picture referencing, i.e. CPRpreviously) coding mode, is adopted. It is realized that IBC referencesamples should be stored in on-chip memory and thus a limited referencearea of one CTU is defined. To restrict the extra on-chip memory for thebuffer, the current design reuses the 64×64 memory for decoding thecurrent VPDU so that only 3 additional 64×64 blocks' memory is needed tosupport IBC. When CTU size is 128×128, currently the reference area isshown in FIG. 2 .

In the current draft (VVC draft 4), the area is defined as

The following conditions shall be true:  ( yCb + ( mvL[ 1 ] >> 4 ) ) >>CtbLog2SizeY = yCb >> CtbLog2SizeY (8-972)  ( yCb + ( mvL[ 1 ] >> 4 ) +cbHeight − 1) >> CtbLog2SizeY = yCb >> (8-973)  CtbLog2SizeY  ( xCb + (mvL[ 0 ] >> 4 ) ) >> CtbLog2SizeY >= ( xCb >> CtbLog2SizeY ) − 1 (8-974) ( xCb + ( mvL[ 0 ] >> 4 ) + cbWidth − 1) >> CtbLog2SizeY <= ( xCb >>(8-975)  CtbLog2SizeY )  [Ed. (SL): conditions (8-218) and (8-216) mighthave been checked by 6.4.X.] When ( xCb + ( mvL[ 0 ] >> 4 ) ) >>CtbLog2SizeY is equal to ( xCb >> CtbLog2SizeY ) − 1, the derivationprocess for block availability as specified in clause 6.4.X [Ed. (BB):Neighbouring blocks availability checking process tbd] is invoked withthe current luma location( xCurr, yCurr ) set equal to ( xCb, yCb ) andthe neighbouring luma location ( ( ( xCb + ( mvL[ 0 ] >> 4 ) +CtbSizeY) >> ( CtbLog2SizeY − 1 ) ) << ( CtbLog2SizeY − 1 ), ( ( yCb + (mvL[ 1 ] >> 4 ) ) >> ( CtbLog2SizeY − 1 ) ) << ( CtbLog2SizeY − 1 ) ) asinputs, and the output shall be equal to FALSE.

Thus, the total reference size is a CTU.

A2. Potential Issues of the Current Design

The current design assumes to reuse the 64×64 memory for decoding thecurrent VPDU and the IBC reference is aligned to VPDU memory reuseaccordingly. Such a design bundles VPDU decoding memory with the IBCbuffer. There might be several issues:

-   -   1. To handle smaller CTU size might be an issue. Suppose that        CTU size is 32×32, it is not clear whether the current 64×64        memory for decoding the current VPDU can support 32×32 level        memory reuse efficiently in different architectures.    -   2. The reference area varies significantly. Accordingly, too        many bitstream conformance constraints are introduced. It places        extra burden to encoder to exploit reference area efficiently        and avoid generating legal bitstreams. It also increases the        possibility to have invalid BVs in different modules, e.g. merge        list. To handle those invalid BVs may introduce extra logics or        extra conformance constraints. It not only introduces burdens to        encoder or decoder, it may also create divergence between BV        coding and MV coding.    -   3. The design does not scale well. Because VPDU decoding is        mixed with IBC buffer, it is not easy to increase or decrease        reference area relative to the current one 128×128 CTU design.        It may limit the flexibility to exploit a better coding        efficiency vs. on-chip memory trade-off in the later        development, e.g. a lower or higher profile.    -   4. The bit-depth of IBC reference buffer is linked with decoding        buffer. Even though screen contents usually have a lower        bit-depth than internal decoding bit-depth, the buffer still        needs to spend memory to store bits mostly representing rounding        or quantization noises. The issue becomes even severe when        considering higher decoding bit-depth configurations.        A3. A Clear IBC Buffer Design

To address issues listed in the above sub-section, we propose to have adedicated IBC buffer, which is not mixed with decoding memory.

For 128×128 CTU, the buffer is defined as 128×128 with 8-bit samples,when a CU (x, y) with size w×h has been decoded, its reconstructionbefore loop-filtering is converted to 8-bit and written to the w×h blockarea starting from position (x % 128, y % 128). Here the modulo operator% always returns a positive number, i.e. for x<0, x % L≙−(−x % L), e.g.−3%128=125.

Assume that a pixel (x,y) is coded in IBC mode with BV=(BVx, BVy), it isprediction sample in the IBC reference buffer locates at ((x+ BVx) %128, (y+ BVy) % 128) and the pixel value will be converted to 10-bitbefore prediction.

When the buffer is considered as (W, H), after decoding a CTU or CUstarting from (x, y), the reconstructed pixels before loop-filteringwill be stored in the buffer starting from (x % W, y % H). Thus, afterdecoding a CTU, the corresponding IBC reference buffer will be updatedaccordingly. Such setting might happen when CTU size is not 128×128. Forexample, for 64×64 CTU, with the current buffer size, it can beconsidered as a 256×64 buffer. For 64×64 CTU, FIG. 2 shows the bufferstatus.

FIG. 12 is an illustration of IBC reference buffer status, where a blockdenotes a 64×64 CTU.

In such a design, because the IBC buffer is different from the VPDUdecoding memory, all the IBC reference buffer can be used as reference.

When the bit-depth of the IBC buffer is 8-bit, compared with the currentdesign that needs 3 additional 10-bit 64×64 buffer, the on-chip memoryincrease is (8*4)/(10*3)−100%=6.7%.

If we further reduce the bit-depth. The memory requirement can befurther reduced. For example, for 7-bit buffer, the on-chip memorysaving is 100%−(7*4)/(10*3)=6.7%.

With the design, the only bitstream conformance constraint is that thereference block shall be within the reconstructed area in the currentCTU row of the current Tile.

When initialization to 512 is allowed at the beginning of each CTU row,all bitstream conformance constraints can be removed.

A4. Experimental Results

In some embodiments, the disclosed methods can be implemented usingVTM-4.0 software.

For a 10-bit buffer implementation and CTC, the decoder is fullycompatible to the current VTM4.0 encoder, which means that the proposeddecoder can exactly decode the VTM-4.0 CTC bitstreams.

For a 7-bit buffer implementation, the results shown in Table I.

For a 8-bit buffer implementation, the results shown in Table II.

TABLE I Performance with a 7-bit buffer. The anchor is VTM-4.0 with IBCon for all sequences. All Intra Over VTM-4.0 w/ IBC on Y U V EncT DecTClass A1 −0.01% −0.09% −0.10% 132% 101% Class A2  0.05%  0.00%  0.06%135% 100% Class B  0.00% −0.02%  0.01% 135% 100% Class C −0.02%  0.01% 0.03% 130%  98% Class E −0.13% −0.16% −0.04% 135%  99% Overall −0.02%−0.05%  0.00% 133% 100% Class D  0.04%  0.04%  0.12% 127% 107% Class F−0.99% −1.14% −1.18% 115%  99% 4:2:0 TGM −2.57% −2.73% −2.67% 104% 102%Random Access Over VTM-4.0 w/ IBC on Y U V EncT DecT Class Al  0.02%−0.01%  0.01% 109% 100% Class A2  0.00% −0.04%  0.03% 111% 100% Class B−0.01% −0.10% −0.22% 113% 101% Class C −0.01%  0.17%  0.12% 115% 100%Class E Overall  0.00%  0.00% −0.04% 112% 100% Class D  0.05%  0.16% 0.20% 117% 101% Class F −0.71% −0.77% −0.77% 109%  99% 4:2:0 TGM −1.81%−1.65% −1.64% 107% 101% Low delay B Over VTM-4.0 w/ IBC on Y U V EncTDecT Class A1 Class A2 Class B  0.01%  0.36%  0.30% 114%  95% Class C−0.01% −0.12% −0.10% 120%  98% Class E  0.10%  0.20%  0.18% 107%  99%Overall  0.03%  0.16%  0.13% 114%  97% Class D −0.01%  1.07%  0.18% 123%104% Class F −0.79% −0.89% −1.01% 110% 100% 4:2:0 TGM −1.36% −1.30%−1.26% 109% 102%

TABLE II Performance with a 8-bit buffer. The anchor is VTM-4. 0 withIBC on for all sequences. All Intra Over VTM-4.0 w/ IBC on Y U V EncTDecT Class A1 −0.01%  0.02% −0.10% 129% 102% Class A2  0.02% −0.06%−0.02% 134% 102% Class B −0.04% −0.02% −0.07% 135% 101% Class C −0.03% 0.04%  0.00% 130%  98% Class E −0.16% −0.14% −0.08% 134% 100% Overall−0.04% −0.03% −0.05% 133% 100% Class D  0.00%  0.04%  0.02% 126% 101%Class F −1.31% −1.27% −1.29% 114%  98% 4:2:0 TGM −3.23% −3.27% −3.24%101% 100% Random Access Over VTM-4.0 w/ IBC on Y U V EncT DecT Class A1−0.01% −0.08%  0.04% 107%  99% Class A2 −0.03% −0.16%  0.06% 110%  99%Class B −0.01% −0.14% −0.22% 111%  99% Class C −0.01%  0.15%  0.09% 115%100% Class E Overall −0.01% −0.05% −0.03% 111%  99% Class D  0.01% 0.19%  0.22% 116% 101% Class F −1.01% −0.99% −1.01% 108%  99% 4:2:0 TGM−2.33% −2.14% −2.19% 105% 100% Low delay B Over VTM-4.0 w/ IBC on Y U VEncT DecT Class A1 Class A2 Class B  0.00%  0.04% −0.14% 113% #NUM!Class C −0.05% −0.28% −0.15% 119%  98% Class E  0.04% −0.16%  0.43% 107%#NUM! Overall  0.00% −0.11%  0.00% 113% #NUM! Class D −0.07%  1.14% 0.13% 122%  99% Class F −0.81% −0.92% −0.96% 111%  99% 4:2:0 TGM −1.71%−1.67% −1.71% 106%  95%

FIG. 17 is a block diagram showing an example video processing system1700 in which various techniques disclosed herein may be implemented.Various implementations may include some or all of the components of thesystem 1700. The system 1700 may include input 1702 for receiving videocontent. The video content may be received in a raw or uncompressedformat, e.g., 8 or 10 bit multi-component pixel values, or may be in acompressed or encoded format. The input 1702 may represent a networkinterface, a peripheral bus interface, or a storage interface. Examplesof network interface include wired interfaces such as Ethernet, passiveoptical network (PON), etc. and wireless interfaces such as Wi-Fi orcellular interfaces.

The system 1700 may include a coding component 1704 that may implementthe various coding or encoding methods described in the presentdocument. The coding component 1704 may reduce the average bitrate ofvideo from the input 1702 to the output of the coding component 1704 toproduce a coded representation of the video. The coding techniques aretherefore sometimes called video compression or video transcodingtechniques. The output of the coding component 1704 may be eitherstored, or transmitted via a communication connected, as represented bythe component 1706. The stored or communicated bitstream (or coded)representation of the video received at the input 1702 may be used bythe component 1708 for generating pixel values or displayable video thatis sent to a display interface 1710. The process of generatinguser-viewable video from the bitstream representation is sometimescalled video decompression. Furthermore, while certain video processingoperations are referred to as “coding” operations or tools, it will beappreciated that the coding tools or operations are used at an encoderand corresponding decoding tools or operations that reverse the resultsof the coding will be performed by a decoder.

Examples of a peripheral bus interface or a display interface mayinclude universal serial bus (USB) or high definition multimediainterface (HDMI) or Displayport, and so on. Examples of storageinterfaces include SATA (serial advanced technology attachment), PCI,IDE interface, and the like. The techniques described in the presentdocument may be embodied in various electronic devices such as mobilephones, laptops, smartphones or other devices that are capable ofperforming digital data processing and/or video display.

FIG. 18 is a flowchart of an example method of visual data processing.Steps of this flowchart are discussed in connection with example 23discussed in Section 4 of this document. At step 1802, the processdetermines, for a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thecurrent video block, a block vector (BVx,BVy), wherein validity of theblock vector (BVx, BVy) is independent of (1) a location (P, Q) of asample block and/or (2) whether a sample at the location (P,Q) isreconstructed, and/or (3) a location of the current video block,wherein, the block vector (BVx, BVy) represents a pixel displacementbetween the current video block and the sample block. At step 1804, theprocess performs, using the block vector, the conversion in an intrablock copy mode which is based on a reconstructed block located in samevideo region with the current video block comprising reference samplesused for deriving a prediction block of the current video block,wherein, during the conversion, a prediction sample with a location (A,B) from reference samples in a buffer is determined at least accordingto a size of the buffer and/or the block vector (BVx, BVy).

FIG. 19 is a flowchart of an example method of visual data processing.Steps of this flowchart are discussed in connection with example 23discussed in Section 4 of this document. At step 1902, the processdetermines, for a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thevisual media data, whether a block vector (BVx, BVy) corresponding tothe current video block is valid according to a rule, wherein the blockvector (BVx, BVy) represents a pixel displacement between the currentvideo block and a sample block. At step 1904, the process performs,using the block vector, the conversion based on a reference region fromthe current picture comprising reference samples used for deriving aprediction block of the current video block, wherein the rule specifiesthat the block vector (BVx, BVy) is valid in case that (1) one or moresamples from the sample block are outside the current picture and/or (2)one or more samples from the sample block are outside at least onecoding tree unit (CTU) associated with the current video block, and/or(3) one or more samples from the sample block fail to be reconstructed.

FIG. 20 is a flowchart of an example method of visual data processing.Steps of this flowchart are discussed in connection with example 44discussed in Section 4 of this document. At step 2002, the processperforms a conversion between a current video block of a current pictureof a visual media data and a bitstream representation of the visualmedia data, wherein, the conversion is based on a reference region fromthe current picture comprising reference samples used for deriving aprediction block of the current video block, and wherein a virtualbuffer of a defined size is used for tracking availability of thereference samples for deriving the prediction block.

FIG. 21 is a flowchart of an example method of visual data processing.Steps of this flowchart are discussed in connection with example 51discussed in Section 4 of this document. At step 2102, the processmaintains, for a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thevisual media data, a buffer comprising reference samples from thecurrent picture for a derivation of a prediction block of the currentvideo block, wherein one or more reference samples in the buffer thatare marked unavailable for the derivation have values outside of a pixelvalue range.

FIG. 22 is a flowchart of an example method of visual data processing.Steps of this flowchart are discussed in connection with example 54discussed in Section 4 of this document. At step 2202, the processperforms a conversion between a current video block of a current pictureof a visual media data and a bitstream representation of the visualmedia data using a buffer comprising reference samples from the currentpicture for derivation of a prediction block of the current video block,wherein the conversion is based according to rule which specifies that,for the bitstream representation to conform the rule, a reference samplein the buffer is to satisfy a bitstream conformance constraint.

Some embodiments of the present document are now presented inclause-based format.

L1. A visual media processing method, comprising:

determining, for a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thecurrent video block, a block vector (BVx,BVy), wherein validity of theblock vector (BVx, BVy) is independent of (1) a location (P, Q) of asample block and/or (2) whether a sample at the location (P,Q) isreconstructed, and/or (3) a location of the current video block,wherein, the block vector (BVx, BVy) represents a pixel displacementbetween the current video block and the sample block; and

performing, using the block vector, the conversion in an intra blockcopy mode which is based on a reconstructed block located in same videoregion with the current video block comprising reference samples usedfor deriving a prediction block of the current video block, wherein,during the conversion, a prediction sample with a location (A, B) fromreference samples in a buffer is determined at least according to a sizeof the buffer and/or the block vector (BVx, BVy).

L2. A visual media processing method, comprising:

determining, for a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thevisual media data, whether a block vector (BVx, BVy) corresponding tothe current video block is valid according to a rule, wherein the blockvector (BVx, BVy) represents a pixel displacement between the currentvideo block and a sample block; and

performing, using the block vector, the conversion based on a referenceregion from the current picture comprising reference samples used forderiving a prediction block of the current video block, wherein the rulespecifies that the block vector (BVx, BVy) is valid in case that (1) oneor more samples from the sample block are outside the current pictureand/or (2) one or more samples from the sample block are outside atleast one coding tree unit (CTU) associated with the current videoblock, and/or (3) one or more samples from the sample block fail to bereconstructed.

L3. The method of clause L2, wherein, upon identifying that the blockvector (BVx, BVy) is valid, a prediction sample with a location (A, B)from reference samples in a buffer is determined at least according to asize of the buffer and/or the block vector (BVx, BVy).

L4. The method of any one or more of clauses L1 or L3, wherein thereference samples in the buffer corresponds to reconstructed samples ofa region of the current picture.

L5. The method of clause L4, wherein the region includes a coding treeunit (CTU) row associated with the current video block.

L6. The method of any one or more of clauses L1-L5, wherein the blockvector (BVx, BVy) is determined to be valid regardless of whether thelocation (P, Q) computed according to the block vector (BVx, BVy) andthe upper-left position (x, y) of the current video block is outside aboundary of a picture.

L7. The method of clause L6, wherein the block vector (BVx, BVy) isvalid regardless of whether x+ BVx<0 or x+ BVx>0.

L8. The method of clause L6, wherein the block vector (BVx, BVy) isvalid regardless of whether x+W+ BVx> W_(pic) or x+W+ BVx<W_(pic), whereW denotes a width of the current video block and W_(pic) denotes a widthof the picture.

L9. The method of clause L6, wherein the block vector (BVx, BVy) isvalid regardless of whether y+ BVy<0 or y+ BVy>0.

L10. The method of clause L6, wherein the block vector (BVx, BVy) isvalid regardless of whether x+H+ BVx> H_(pic) or x+H+ BVx<H_(pic), whereH denotes a height of the current video block and H_(pic) denotes aheight of the picture.

L11. The method of any one or more of clauses L1-L5, wherein the blockvector (BVx, BVy) is valid regardless of whether the location (P, Q)computed according to the block vector (BVx, BVy) and the upper-leftposition (x, y) of the current video block is outside a coding tree unitincluding the current video block.

L12. The method of clause L11, wherein the block vector (BVx, BVy) isvalid regardless of whether y+ BVy<floor(y/H_(ctu))*H_(ctu) or y+ BVy>floor(y/H_(ctu))*H_(ctu), where H_(ctu) denotes a height of the codingtree unit and floor(a) is the largest integer no greater than a.

L13. The method of clause L11, wherein the block vector (BVx, BVy) isvalid regardless of whether y+H+ BVy<floor(y/H_(ctu))*H_(ctu) or y+H+BVy> floor(y/H_(ctu))*H_(ctu), where H denotes a height of the currentvideo block, H_(ctu) denotes a height of the coding tree unit, andfloor(a) is the largest integer no greater than a.

L14. The method of any one or more of clauses L1-L5, wherein the blockvector (BVx, BVy) is valid regardless of whether the location (P, Q)computed according to the block vector (BVx, BVy) and the upper-leftposition (x, y) of the current video block is outside a coding tree unitincluding the current video block and (n−1) coding tree units along aleft direction.

L15. The method of clause L14, wherein the block vector (BVx, BVy) isvalid regardless of whether x+BVx<floor(x/W_(ctu))*W_(ctu)−(n−1)*W_(ctu) or x+ BVx>floor(X/W_(ctu))*W_(ctu)−(n−1)*W_(ctu), where W_(ctu) denotes a weightof the coding tree unit and floor(a) is the largest integer no greaterthan a.

L16. The method of clause L14, wherein the block vector (BVx, BVy) isvalid regardless of whether x+W+ BVx> floor(X/W_(ctu))*W_(ctu)+W_(ctu)or x+W+ BVx<floor(X/W_(ctu))*W_(ctu)+W_(ctu), where W denotes a width ofthe current video block, W_(ctu) denotes a weight of the coding treeunit, and floor(a) is the largest integer no greater than a.

L17. The method of any one or more of clauses L1-L5, wherein the blockvector (BVx, BVy) is valid regardless of whether the location (P, Q)computed according to the block vector (BVx, BVy) and the upper-leftposition (x, y) of the current video block is outside a current CTU rowincluding a current coding tree unit including the current video block.

L18. The method of clause L17, wherein the block vector (BVx, BVy) isvalid regardless of whether Y+ BVy<floor(Y/Hctu)*Hctu or Y+H+BVy>=floor(Y/Hctu)*Hctu+ Hctu, wherein, W_(ctu) and H_(ctu) denote awidth and height of a CTU respectively and floor(a) is the largestinteger no greater than a.

L19. The method of any one or more of clauses L1-L5, wherein the blockvector (BVx, BVy) is determined to be valid regardless of whether asample fails to be reconstructed.

L20. The method of clause L19, wherein the block vector (BVx, BVy) isvalid regardless of whether isRec(x+ BVx, y+ BVy) is false, whereisRec(x,y) is true if pixel (x,y) is reconstructed by an intra blockcopy mode.

L21. The method of clause L19, wherein the block vector (BVx, BVy) isvalid regardless of whether isRec(x+ BVx+W−1, y+ BVy) is false, whereisRec(x,y) is true if pixel (x, y) is reconstructed by an intra blockcopy mode and W denotes a width of the current video block.

L22. The method of clause L19, wherein the block vector (BVx, BVy) isvalid regardless of whether isRec(x+ BVx, y+ BVy+H−1) is false, whereisRec(x,y) is true if pixel (x, y) is reconstructed by an intra blockcopy mode and H denotes a height of the current video block.

L23. The method of clause L19, wherein the block vector (BVx, BVy) isvalid regardless of whether isRec(x+ BVx+W−1, y+ BVy+H−1) is false,where isRec(x, y) is true if pixel (x, y) is reconstructed by an intrablock copy mode, W denotes a width of the current video block, and Hdenotes a height of the current video block.

L24. The method of any one or more of clauses L1-L5 wherein the blockvector (BVx, BVy) is determined to be valid regardless of whether thecurrent video block is included in a first coding tree unit of a codingtree unit row.

L25. The method of any one or more of clauses L1-L5, wherein the blockvector (BVx, BVy) is determined to be valid when all the followingconditions are satisfied: (i) x+ BVx>=0, y+ BVy>=floor(y/Hctu), and(iii) isRec(x+ BVx+W−1, y+ BVy+H−1) is true, where isRec(x, y) is trueif sample (x, y) is reconstructed by an intra block cow mode, W denotesa width of the current video block, H denotes a height of the currentvideo block, where floor(a) is the largest integer no greater than a.

L26. The method of clause L25, wherein the block vector is a located ina first CTU in a CTU row.

L27. The method of clause L3, wherein the prediction sample with thelocation (A, B) is determined according to the size of the buffer, theblock vector (BVx, BVy), and the upper-left position (x, y).

L28. The method of clause L27, wherein the prediction sample with thelocation (A, B) comprises a predication sample with a location computedaccording to ((X+ BVx) % Wbuf, (Y+ BVy) % Hbuf), wherein Wbuf and Hbufdenote a width of the buffer and a height of the buffer respectively.

L29. The method of any one or more of clauses L1-L28, wherein theconversion is performed in an intra block copy mode.

M1. A visual media processing method, comprising:

performing a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thevisual media data,

wherein, the conversion is based on a reference region from the currentpicture comprising reference samples used for deriving a predictionblock of the current video block, and

wherein a virtual buffer of a defined size is used for trackingavailability of the reference samples for deriving the prediction block.

M2. The method of clause M1, wherein the virtual buffer is maintainedusing a virtual pipeline data unit (VPDU), and wherein a size of thevirtual buffer is m*W_(VPDU)×n*H_(VPDU), where W_(VPDU) and H_(VPDU)denote a width and a height of the VPDU.

M3. The method of clause M2, wherein m=4 and n=2.

M4. The method of clause M2, wherein m and/or n are based at least inpart on a resolution of a picture associated with the current videoblock or a size of a coding tree unit including the current video block.

M5. The method of clause M2, wherein m and/or are predefined quantities.

M6. The method of clause M2, wherein m and/or are signaled as fields inthe bitstream representation.

M7. The method of clause M1, wherein a sample in the current video blockis mapped to (x % (m*W_(VPDU)), y % (n*H_(VPDU))) in the virtual buffer,where the sample in the current video block is located at (x, y)relative to a upper-left corner of a picture; “x % y” is defined asy=x−y*floor(x/y), where floor(a) is the largest integer no greater thana, and W_(VPDU) and H_(VPDU) denote a width and a height of the VPDU.

M8. The method of clause M1, further comprising:

using an array for tracking availabilities of samples stored in thevirtual buffer.

M9. The method of clause M8, wherein the array includes a flag toindicate if one or more samples stored in the buffer are used forprediction in an intra block copy mode.

M10. The method of clause M8, wherein the array corresponds to one ormore VPDUs of size 3×2.

M11. The method of clause M8, wherein the array corresponds to one ormore VPDUs of size 4×2.

M12. The method of clause M1, wherein a subset of samples stored in thevirtual buffer are flagged as unavailable for prediction.

M13. The method of clause M12, wherein, the subset of samples flagged asunavailable for prediction are based on a position of a most-recentlyprocessed VPDU.

M14. The method of clause M13, wherein the samples are flagged asunavailable at a beginning of processing a VPDU.

M15. The method of clause M14, wherein, if yPrevVPDU % (n*H_(VPDU)) i sequal to 0, then the subset of samples located at positions (x, y) areflagged as unavailable, wherein x lies in a first predetermined rangeand y lies in a second predetermined range, where (xPrevVPDU, yPrevVPDU)denotes an upper-left corner of a coding tree unit of a most-recentlyprocessed VPDU, and W_(VPDU) and H_(VPDU) denote a width and a height ofthe VPDU.

M16. The method of clause M15, wherein the first range is expressed as[xPrevVPDU−2 W_(VPDU)+2 mW_(VPDU)) % mW_(VPDU),((xPrevVPDU−2*W_(VPDU)+2*m*M_(VPDU)) % (m*W_(VPDU)))−1+W_(VPDU)] and thesecond range is expressed as [yPrevVPDU % (n*H_(VPDU)), (yPrevVPDU %(n*H_(VPDU)))−1+H_(VPDU)].

M17. The method of clause M15, wherein the first range is expressed as[xPrevVPDU−2*W_(VPDU)+2*m*W_(VPDU)) % mW_(VPDU),((xPrevVPDU−2*W_(VPDU)+2*m*W_(VPDU)) % (m*W_(VPDU)))−1+W_(VPDU)] and thesecond range is expressed as [yPrevVPDU % (n*H_(VPDU)), (yPrevVPDU %(n*H_(VPDU)))−1+H_(VPDU)].

M18. The method of clause M14, wherein, if yPrevVPDU % (n*H_(VPDU)) isnot equal to 0, then the subset of samples located at positions (x, y)are flagged as unavailable, wherein x lies in a first predeterminedrange and y lies in a second predetermined range, where (xPrevVPDU,yPrevVPDU) denotes an upper-left corner of a coding tree unit of amost-recently processed VPDU, and W_(VPDU) and H_(VPDU) denote a widthand a height of the VPDU.

M19. The method of clause M18, wherein the first range is expressed as[xPrevVPDU−W_(VPDU)+2*m*W_(VPDU)) % (m*W_(VPDU)),((xPrevVPDU−W_(VPDU)+2*m*W_(VPDU)) % (m*W_(VPDU))−1+W_(VPDU)] and thesecond range is expressed as [yPrevVPDU % (n*H_(VPDU)), (yPrevVPDU %(n*H_(VPDU)))−1+H_(VPDU)].

M20. The method of clause M18, wherein the first range is expressed as[xPrevVPDU−W_(VPDU)+2*m*W_(VPDU)) % mW_(VPDU),((xPrevVPDU−W_(VPDU)+2*m*W_(VPDU)) % (m*W_(VPDU)))−1+W_(VPDU)] and thesecond range is expressed as [yPrevVPDU % (n*H_(VPDU)), (yPrevVPDU %(n*H_(VPDU)))−1+H_(VPDU)].

M21. The method of clause M12, wherein, when the coding tree includesVPDUs, the subset of samples flagged as unavailable for prediction arebased on a position of a most-recently processed coding tree unit.

M22. The method of clause M21, wherein the samples are flagged asunavailable at a beginning of processing a coding tree unit.

M23. The method of any one or more of clauses M1-M22, furthercomprising:

determining validity of a block vector corresponding to the currentvideo block based on an upper-left position of the current video block,a bottom-left position of the current video block, and a bottom-rightposition of the current video block, wherein the determining excludesuse of a upper-right position of the current video block.

M24. The method of any one or more of clauses M1-M23, wherein theconversion is performed in an intra block copy mode.

N1. A visual media processing method, comprising:

maintaining, for a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thevisual media data, a buffer comprising reference samples from thecurrent picture for a derivation of a prediction block of the currentvideo block,

wherein one or more reference samples in the buffer that are markedunavailable for the derivation have values outside of a pixel valuerange.

N2. The method of clause N1, wherein the pixel value range is expressedas [0, 1<<(bit_depth)−1], where bit_depth is a positive integer.

N3. The method of clause N2, wherein bit_depth is a precision used forprocessing the sample.

N4. The method of clause N1, wherein the method further comprises:

initializing a set of samples in the buffer to a predetermined valueindicative of unavailability of the set of samples.

N5. The method of clause N4, wherein the predetermined value is −1.

N6. The method of any one or more of clauses N4-N5, wherein locations ofthe set of samples and/or whether to initialize the set of the samplesto the predetermined value is/are based on one or more of: a position ofthe current video block, a size of the current video block, a size of aVPDU including the current video block, and/or a size of a coding treeunit including the current video block.

N7. The method of clause N6, wherein, if (xCb % vSize) is equal to 0 and(yCb % vSize) is equal to 0, the set of samples are marked asunavailable, where xCb, yCb denote a position of the current video blockrelative to the sample and vSize=min(ctbSize, 64), where ctbSize denotesa width or a height of the coding tree unit.

N8. The method of clause N1, wherein, if a size of the current videoblock is less than min(ctbSize, 64), the set of samples in the bufferare marked unavailable, where ctbSize denotes a width or a height of thecoding tree unit.

N9. The method of clause N8, wherein locations of the plurality ofsamples are related to a size of a VPDU.

N10. The method of clause N8, wherein locations of the set of samplesare related to a size of the coding tree unit including the currentvideo block.

N11. The method of clause N4, wherein the set of samples in the bufferhave with positions expressed as (x % wIbcBuf, y % hIbcBuf), where x=xV,. . . , xV+ ctbSize−1 and y=yV, . . . , yV+ ctbSize−1, and xV, yV denotethe upper-left position of a VPDU relative to an upper-left position ofa picture, where ctbSize denotes a size of the coding tree unitincluding the current video block, and wIbcBuf and hIbcBuf denote abuffer width and a buffer height.

N12. The method of clause N11, wherein the set of samples in the bufferare initalized to −1.

N13. The method of clause N4, wherein the set of samples are initializedat a beginning of decoding a video unit.

N14. The method of any one or more of clauses N1-N13, wherein theconversion is performed in an intra block copy mode.

O1. A visual media processing method, comprising:

performing a conversion between a current video block of a currentpicture of a visual media data and a bitstream representation of thevisual media data using a buffer comprising reference samples from thecurrent picture for derivation of a prediction block of the currentvideo block,

wherein the conversion is based according to rule which specifies that,for the bitstream representation to conform the rule, a reference samplein the buffer is to satisfy a bitstream conformance constraint.

O2. The method of clause O1, wherein the bitstream conformanceconstraint is based on at least one of (1) a value of the referencesample in the buffer and/or (2) an availability information of thesample in the buffer.

O3. The method of any one or more of clauses O1-O2, wherein thebitstream conformance constraint specifies that the bitstreamrepresentation is non-conforming, if the sample in the buffer has avalue outside of a pixel range.

O4. The method of clause O3, wherein the range is [K0, K1], wherein K0is set to 0 and K1 is set to (1<<BitDepth−1), where BitDepth representsa precision of a prediction sample.

O5. The method of any one or more of clauses O1-O2, wherein thebitstream conformance constraint specifies that the bitstreamrepresentation is non-conforming, if the availability information of thesample in the buffer indicates that the sample is unavailable for thecurrent video block.

O6. The method of any one or more of clauses O1-O2, wherein the sampleis a luma sample, and wherein the bitstream conformance constraintspecifies that the bitstream representation is non-conforming, if theavailability information of the sample in the buffer indicates that thesample is unavailable for the current video block and a single treepartitioning is used for the current video block.

O7. The method of clause any one or more of clauses O1-O6, furthercomprising:

marking the availability information of the sample according to thevalue of the sample in the buffer.

O8. The method of clause O7, wherein, if the value of the sample lies inan interval denoted as [K0, K1], the availability information of thesample is marked as available.

O9. The method of clause O8, wherein K0 is set to 0 and K1 is set to(1<<BitDepth−1), where BitDepth is represents a precision of aprediction sample.

O10. The method of any one or more of clauses O1-O8, wherein thebitstream conformance constraint is further based on a partitioning typeand a tree type of a coding unit associated with the current videoblock.

O11. The method of clause O10, wherein, if the partitioning type is dualtree and the tree type is single tree, then the bitstream conformanceconstraint specifies checking if all color components of the sample aremarked as unavailable.

O12. The method of clause O10, wherein if the partitioning type is dualtree and the tree type is dual tree, then the bitstream conformanceconstraint specifies excludes checking if a chroma component of thesample is marked as unavailable.

O13. The method of any one or more of clauses O1-O12, wherein theconversion is performed in an intra block copy mode.

XX. The method of any of clauses L1-XX, wherein the conversion includesgenerating the bitstream representation from the current video block.

XX. The method of any of clauses L1-XX, wherein the conversion includesgenerating pixel values of the current video block from the bitstreamrepresentation.

XX. A video encoder apparatus comprising a processor configured toimplement a method recited in any one or more of clauses L1-XX.

XX. A video decoder apparatus comprising a processor configured toimplement a method recited in any one or more of clauses L1-XX.

XX. A computer readable medium having code stored thereon, the codeembodying processor-executable instructions for implementing a methodrecited in any of or more of clauses L1-XX.

In the present document, the term “video processing” may refer to videoencoding, video decoding, video compression or video decompression. Forexample, video compression algorithms may be applied during conversionfrom pixel representation of a video to a corresponding bitstreamrepresentation or vice versa. The bitstream representation of a currentvideo block may, for example, correspond to bits that are eitherco-located or spread in different places within the bitstream, as isdefined by the syntax. For example, a macroblock may be encoded in termsof transformed and coded error residual values and also using bits inheaders and other fields in the bitstream.

From the foregoing, it will be appreciated that specific embodiments ofthe presently disclosed technology have been described herein forpurposes of illustration, but that various modifications may be madewithout deviating from the scope of the invention. Accordingly, thepresently disclosed technology is not limited except as by the appendedclaims.

Implementations of the subject matter and the functional operationsdescribed in this patent document can be implemented in various systems,digital electronic circuitry, or in computer software, firmware, orhardware, including the structures disclosed in this specification andtheir structural equivalents, or in combinations of one or more of them.Implementations of the subject matter described in this specificationcan be implemented as one or more computer program products, i.e., oneor more modules of computer program instructions encoded on a tangibleand non-transitory computer readable medium for execution by, or tocontrol the operation of, data processing apparatus. The computerreadable medium can be a machine-readable storage device, amachine-readable storage substrate, a memory device, a composition ofmatter effecting a machine-readable propagated signal, or a combinationof one or more of them. The term “data processing unit” or “dataprocessing apparatus” encompasses all apparatus, devices, and machinesfor processing data, including by way of example a programmableprocessor, a computer, or multiple processors or computers. Theapparatus can include, in addition to hardware, code that creates anexecution environment for the computer program in question, e.g., codethat constitutes processor firmware, a protocol stack, a databasemanagement system, an operating system, or a combination of one or moreof them.

A computer program (also known as a program, software, softwareapplication, script, or code) can be written in any form of programminglanguage, including compiled or interpreted languages, and it can bedeployed in any form, including as a stand-alone program or as a module,component, subroutine, or other unit suitable for use in a computingenvironment. A computer program does not necessarily correspond to afile in a file system. A program can be stored in a portion of a filethat holds other programs or data (e.g., one or more scripts stored in amarkup language document), in a single file dedicated to the program inquestion, or in multiple coordinated files (e.g., files that store oneor more modules, sub programs, or portions of code). A computer programcan be deployed to be executed on one computer or on multiple computersthat are located at one site or distributed across multiple sites andinterconnected by a communication network.

The processes and logic flows described in this specification can beperformed by one or more programmable processors executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, e.g., an FPGA (field programmable gate array) or an ASIC(application specific integrated circuit).

Processors suitable for the execution of a computer program include, byway of example, both general and special purpose microprocessors, andany one or more processors of any kind of digital computer. Generally, aprocessor will receive instructions and data from a read only memory ora random access memory or both. The essential elements of a computer area processor for performing instructions and one or more memory devicesfor storing instructions and data. Generally, a computer will alsoinclude, or be operatively coupled to receive data from or transfer datato, or both, one or more mass storage devices for storing data, e.g.,magnetic, magneto optical disks, or optical disks. However, a computerneed not have such devices. Computer readable media suitable for storingcomputer program instructions and data include all forms of nonvolatilememory, media and memory devices, including by way of examplesemiconductor memory devices, e.g., EPROM, EEPROM, and flash memorydevices. The processor and the memory can be supplemented by, orincorporated in, special purpose logic circuitry.

It is intended that the specification, together with the drawings, beconsidered exemplary only, where exemplary means an example. As usedherein, the use of “or” is intended to include “and/or”, unless thecontext clearly indicates otherwise.

While this patent document contains many specifics, these should not beconstrued as limitations on the scope of any invention or of what may beclaimed, but rather as descriptions of features that may be specific toparticular embodiments of particular inventions. Certain features thatare described in this patent document in the context of separateembodiments can also be implemented in combination in a singleembodiment. Conversely, various features that are described in thecontext of a single embodiment can also be implemented in multipleembodiments separately or in any suitable subcombination. Moreover,although features may be described above as acting in certaincombinations and even initially claimed as such, one or more featuresfrom a claimed combination can in some cases be excised from thecombination, and the claimed combination may be directed to asubcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. Moreover, the separation of various system components in theembodiments described in this patent document should not be understoodas requiring such separation in all embodiments.

Only a few implementations and examples are described and otherimplementations, enhancements and variations can be made based on whatis described and illustrated in this patent document.

What is claimed is:
 1. A method of processing video data, comprising:determining, for a conversion between a current video block of a currentpicture of a video and a bitstream of the video, that a first predictionmode is applied on the current video block; maintaining, for the firstprediction mode, a virtual buffer of a defined size comprising referencesamples derived from a reference region from the current picture;deriving, for the current video block, a prediction block determined bya block vector in the virtual buffer; and performing the conversion atleast based on the prediction block, wherein a subset of referencesamples in the virtual buffer are unavailable for deriving theprediction block, wherein locations of the subset of reference samplesare determined based on a size of a virtual unit, wherein, when thecurrent video block contains one or more virtual units, the locations ofthe subset of reference samples are determined further based on a sizeof the current video block, wherein locations of the subset of referencesamples are determined based on (x0, y0), wherein y0% Vsize=0, (x0, y0)specifies a location in the current picture, where Vsize denotes thesize of the virtual unit, wherein locations of the subset of referencesamples are determined further based on a value of x0% Vsize, andwherein % is a modulo operation.
 2. The method of claim 1, wherein thesize of the virtual buffer is m×W×n×H, where W denotes a width of thevirtual unit, H denotes a height of the virtual unit, and m and n areintegers.
 3. The method of claim 2, wherein the values of m and n dependon the size of a coding tree block.
 4. The method of claim 3, whereinm=4, and n=2.
 5. The method of claim 1, wherein the subset of referencesamples locates at positions (x, y) in the virtual buffer, wherein xlies in a first predetermined range in the virtual buffer determinedbased on x0, wherein y lies in a second predetermined range in thevirtual buffer determined based on y0, and wherein (x0, y0) denotes anupper-left corner of a virtual unit.
 6. The method of claim 5, whereinthe first predetermined range and the second predetermined range aredetermined further based on Vsize.
 7. The method of claim 1, wherein thevirtual buffer is reset before coding a picture or a slice.
 8. Themethod of claim 1, wherein the conversion includes encoding the currentvideo block into the bitstream.
 9. The method of claim 1, wherein theconversion includes decoding the current video block from the bitstream.10. The method of claim 1, wherein the size of the virtual unit is equalto 64 or equal to a size of a coding tree block including the currentvideo block.
 11. An apparatus for processing video data comprising aprocessor and a non-transitory memory with instructions thereon, whereinthe instructions upon execution by the processor, cause the processorto: determine, for a conversion between a current video block of acurrent picture of a video and a bitstream of the video, that a firstprediction mode is applied on the current video block; maintain, for thefirst prediction mode, a virtual buffer of a defined size comprisingreference samples derived from a reference region from the currentpicture; derive, for the current video block, a prediction blockdetermined by a block vector in the virtual buffer; and perform theconversion at least based on the prediction block, wherein a subset ofreference samples in the virtual buffer are unavailable for deriving theprediction block, wherein locations of the subset of reference samplesare determined based on a size of a virtual unit, wherein, when thecurrent video block contains one or more virtual units, the locations ofthe subset of reference samples are determined further based on a sizeof the current video block, wherein locations of the subset of referencesamples are determined based on (x0, y0), wherein y0% Vsize=0, (x0, y0)specifies a location in the current picture, where Vsize denotes thesize of the virtual unit, wherein locations of the subset of referencesamples are determined further based on a value of x0% Vsize, andwherein % is a modulo operation.
 12. The apparatus of claim 11, whereinthe size of the virtual buffer is m×W×n×H, where W denotes a width ofthe virtual unit, H denotes a height of the virtual unit, and m and nare integers.
 13. The apparatus of claim 11, wherein the subset ofreference samples locates at positions (x, y) in the virtual buffer,wherein x lies in a first predetermined range in the virtual bufferdetermined based on x0, wherein y lies in a second predetermined rangein the virtual buffer determined based on y0, and wherein (x0, y0)denotes an upper-left corner of a virtual unit.
 14. The apparatus ofclaim 13, wherein the first predetermined range and the secondpredetermined range are determined further based on Vsize.
 15. Theapparatus of claim 11, wherein the virtual buffer is reset before codinga picture or a slice.
 16. A non-transitory computer-readable storagemedium storing instructions that cause a processor to: determine, for aconversion between a current video block of a current picture of a videoand a bitstream of the video, that a first prediction mode is applied onthe current video block; maintain, for the first prediction mode, avirtual buffer of a defined size comprising reference samples derivedfrom a reference region from the current picture; derive, for thecurrent video block, a prediction block determined by a block vector inthe virtual buffer; and perform the conversion at least based on theprediction block, wherein a subset of reference samples in the virtualbuffer are unavailable for deriving the prediction block, whereinlocations of the subset of reference samples are determined based on asize of a virtual unit, wherein, when the current video block containsone or more virtual units, the locations of the subset of referencesamples are determined further based on a size of the current videoblock, wherein locations of the subset of reference samples aredetermined based on (x0, y0), wherein y0% Vsize=0, (x0, y0) specifies alocation in the current picture, where Vsize denotes the size of thevirtual unit, wherein locations of the subset of reference samples aredetermined further based on a value of x0% Vsize, and wherein % is amodulo operation.
 17. A non-transitory computer-readable recordingmedium storing a bitstream which is generated by a method performed by avideo processing apparatus, wherein the method comprises: determining,that a first prediction mode is applied on a current video block of acurrent picture of a video; maintaining, for the first prediction mode,a virtual buffer of a defined size comprising reference samples derivedfrom a reference region from the current picture; deriving, for thecurrent video block, a prediction block determined by a block vector inthe virtual buffer; and generating the bitstream from the current videoblock at least based on the prediction block, wherein a subset ofreference samples in the virtual buffer are unavailable for deriving theprediction block, wherein locations of the subset of reference samplesare determined based on a size of a virtual unit, wherein, when thecurrent video block contains one or more virtual units, the locations ofthe subset of reference samples are determined further based on a sizeof the current video block, wherein locations of the subset of referencesamples are determined based on (x0, y0), wherein y0% Vsize=0, (x0, y0)specifies a location in the current picture, where Vsize denotes thesize of the virtual unit, wherein locations of the subset of referencesamples are determined further based on a value of x0% Vsize, andwherein % is a modulo operation.